This program first declares an array of integers with 3 elements. Then, it displays the elements and also the array's total length.
Module Module1
Sub Main()
' Create array of three elements.
Dim arr(2) As Integer
arr(0) = 1
arr(1) = 2
arr(2) = 3
' Display all elements and the length.
For Each value As Integer In arr
Console.Write(value)
Console.Write(
" ")
Next
Console.Write(
"- ")
Console.WriteLine(arr.Length)
' Call Array.Resize.
Array.Resize(arr, 6)
' Display all elements and the length.
For Each value As Integer In arr
Console.Write(value)
Console.Write(
" ")
Next
Console.Write(
"- ")
Console.WriteLine(arr.Length)
End Sub
End Module
1 2 3 - 3
1 2 3 0 0 0 - 6