Module Tester
Sub Main()
Dim i, j As Integer
' create rectangular two-dimensional array
Dim array1 As Integer(,)
array1 = New Integer(,) {{1, 2, 3}, {4, 5, 6}}
' create jagged two-dimensional array
Dim array2 As Integer()() = New Integer(2)() {}
array2(0) = New Integer() {1, 2}
array2(1) = New Integer() {3}
array2(2) = New Integer() {4, 5, 6}
For i = 0 To array1.GetUpperBound(0)
For j = 0 To array1.GetUpperBound(1)
Console.Write(array1(i, j) & " ")
Next
Console.WriteLine("")
Next
For i = 0 To array2.GetUpperBound(0)
For j = 0 To array2(i).GetUpperBound(0)
Console.WriteLine(array2(i)(j) & " ")
Next
Console.WriteLine("")
Next
End Sub
End Module
|