【发布时间】:2023-04-11 11:49:01
【问题描述】:
我正在尝试使用值数组格式化字符串:
Dim args(2) As Object
args(0) = "some text"
args(1) = "more text"
args(2) = "and other text"
Test(args)
函数测试是:
Function Test(ByVal args As Object)
Dim MailContent as string = "Dear {0}, This is {1} and {2}."
'tried both with and without converting arr to Array
args = CType(args, Array)
MailContent = String.Format(MailContent, args) 'this line throws the error: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
End Function
【问题讨论】:
-
这是一种特别的语言吗?