Changes the number of elements of an array to the specified new size.
Imports System
Public Class SamplesArray
Public Shared Sub Main()
Dim myArr As String() = {"The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"}
PrintIndexAndValues(myArr)
Array.Resize(myArr, myArr.Length + 5)
PrintIndexAndValues(myArr)
Array.Resize(myArr, 4)
PrintIndexAndValues(myArr)
End Sub 'Main
Public Shared Sub PrintIndexAndValues(myArr() As String)
Dim i As Integer
For i = 0 To myArr.Length - 1
Console.WriteLine("[{0}] : {1}", i, myArr(i))
Next i
End Sub
End Class
Related examples in the same category