Clear multi-dimensional array
Imports System
Imports Microsoft.VisualBasic
Module Example
Sub Main()
Dim numbers2(,) As Integer = {{ 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }}
For i As Integer = 0 To 2
For j As Integer = 0 To 2
Console.WriteLine("{0} ", numbers2(i, j))
Next j
Next i
Array.Clear(numbers2, 2, 5)
For i As Integer = 0 To 2
For j As Integer = 0 To 2
Console.Write("{0} ", numbers2(i, j))
Next j
Next i
Dim numbers3(,,) As Integer = {{{ 1, 2 }, { 3, 4 }}, _
{{ 5, 6 }, { 7, 8 }}, _
{{ 9,10 }, {11,12 }}}
For i As Integer = 0 To 1
For j As Integer = 0 To 1
For k As Integer = 0 To 1
Console.Write("{0} ", numbers3(i, j, k))
Next k
Console.WriteLine()
Next j
Console.WriteLine()
Next i
Array.Clear(numbers3, 2, 5)
For i As Integer = 0 To 1
For j As Integer = 0 To 1
For k As Integer = 0 To 1
Console.Write("{0} ", numbers3(i, j, k))
Next k
Console.WriteLine()
Next j
Console.WriteLine()
Next i
End Sub
End Module
Related examples in the same category