Imports System
Imports Microsoft.VisualBasic
Public Class SamplesArray
Public Shared Sub Main()
Dim my1DIntArray As Array = Array.CreateInstance(GetType(Int32), 5)
Dim my3DIntArray As Array = Array.CreateInstance(GetType(Int32), 2, 3, 4)
Dim i As Integer
For i = my1DIntArray.GetLowerBound(0) To my1DIntArray.GetUpperBound(0)
my1DIntArray.SetValue(i + 1, i)
Next i
Dim j, k As Integer
For i = my3DIntArray.GetLowerBound(0) To my3DIntArray.GetUpperBound(0)
For j = my3DIntArray.GetLowerBound(1) To my3DIntArray.GetUpperBound(1)
For k = my3DIntArray.GetLowerBound(2) To my3DIntArray.GetUpperBound(2)
my3DIntArray.SetValue(i * j * k, i, j, k)
Next k
Next j
Next i
End Sub
Public Shared Sub PrintValues(myArr As Array)
Dim myEnumerator As System.Collections.IEnumerator = myArr.GetEnumerator()
While myEnumerator.MoveNext()
Console.WriteLine(myEnumerator.Current)
End While
End Sub
End Class