我正在尝试将下面的2d数组显示为行和列。
Module Module1
Sub Main()
'declaring and initializing a 2d array
Dim a1(,) As Integer = {{2, 3}, {5, 3}}
For Each ele As Integer In a1
Console.WriteLine(ele)
Next
End Sub
End Module
我需要输出如下:
2 5
3 3
我需要你的帮助。请
答案 0 :(得分:3)
分别循环遍历每个维度:
For I as Integer = 0 to a1.GetUpperBound(0)
For J as Integer = 0 to a1.GetUpperBound(1)
Console.Write("{0} ", a1(j,i))
Next
console.WriteLine()
Next