Public Class SamplesArray2
Public Shared Sub Main()
Dim myArrayZero As Array = Array.CreateInstance(GetType(String), 3)
myArrayZero.SetValue("zero", 0)
myArrayZero.SetValue("one", 1)
PrintIndexAndValues(myArrayZero)
Dim myArrLen As Integer() = {4}
Dim myArrLow As Integer() = {2}
Dim myArrayTwo As Array = Array.CreateInstance(GetType(String), myArrLen, myArrLow)
myArrayTwo.SetValue("two", 2)
myArrayTwo.SetValue("three", 3)
myArrayTwo.SetValue("four", 4)
myArrayTwo.SetValue("five", 5)
PrintIndexAndValues(myArrayTwo)
myArrayZero.CopyTo(myArrayTwo, 3)
PrintIndexAndValues(myArrayTwo)
End Sub
Public Shared Sub PrintIndexAndValues(myArray As Array)
Dim i As Integer
For i = myArray.GetLowerBound(0) To myArray.GetUpperBound(0)
Console.WriteLine(myArray.GetValue(i))
Next i
End Sub
End Class