如何在VB.NET中创建一个具有无限范围的数组,并获得包含?
的变量数我试过:
Dim _items(,) As String
_items(0, 0) = "hy"
_items(0, 1) = "hello"
_items(1, 0) = "bye"
_items(1, 1) = "bye2"
MsgBox(_items.GetLength(1)) 'But i cant get the length
非常感谢
答案 0 :(得分:2)
我认为你的语法错了
Dim n As Integer = 2
Dim str As String(,) = New String(n - 1, n - 1) {}
MsgBox(_items.GetLength(1)) //if n is 3 then this will return 3
Dim n,m As Integer
n=3,m=2
Dim str As String(,) = New String(n - 1, m - 1) {}
MsgBox(_items.GetLength(1)) // return 2
MsgBox(_items.GetLength(1)) // return 3