Imports System
Public Class Zero2DArray_VB
Public Shared Sub PrintArray(ByVal array As Integer()())
Dim rows As Integer = array.Length
Dim cols As Integer = array(0).Length
For i As Integer = 0 To rows - 1
For j As Integer = 0 To cols - 1
Console.Write($"{array(i)(j), 4}")
Next
Console.WriteLine()
Next
Console.WriteLine()
End Sub
Public Shared Sub Main(ByVal args As String())
Dim array As Integer()() = New Integer()() {
New Integer() {31, 22, 33},
New Integer() {42, 85, 987}
}
PrintArray(array)
For i As Integer = 0 To array.Length - 1
Array.Clear(array(i), 0, array(i).Length)
Next
PrintArray(array)
End Sub
End Class
' run:
'
' 31 22 33
' 42 85 987
'
' 0 0 0
' 0 0 0
'