Imports System
Imports Microsoft.VisualBasic
Public Class SamplesArray
Public Shared Sub Main()
Dim myIntArray As Array = Array.CreateInstance(GetType(System.Int32), 5)
Dim i As Integer
For i = myIntArray.GetLowerBound(0) To myIntArray.GetUpperBound(0)
myIntArray.SetValue(i + 1, i)
Next i
Dim myObjArray As Array = Array.CreateInstance(GetType(System.Object), 5)
For i = myObjArray.GetLowerBound(0) To myObjArray.GetUpperBound(0)
myObjArray.SetValue(i + 26, i)
Next i
PrintValues(myIntArray)
PrintValues(myObjArray)
Array.Copy(myIntArray, myIntArray.GetLowerBound(0), myObjArray, myObjArray.GetLowerBound(0), 1)
Array.Copy(myObjArray, myObjArray.GetUpperBound(0) - 1, myIntArray, myIntArray.GetUpperBound(0) - 1, 2)
PrintValues(myIntArray)
PrintValues(myObjArray)
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