如何创建空的一维字符串数组?
最佳答案
VB 是 0-indexed in array declarations ,所以像 Dim myArray(10) as String
这样的东西会给你 11 个元素。这是从 C 语言翻译时的常见错误。
因此,对于空数组,以下任一方法都可以:
Dim str(-1) as String ' -1 + 1 = 0, so this has 0 elements
Dim str() as String = New String() { } ' implicit size, initialized to empty
关于.net - VB.NET 空字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44713/