Jagged two-dimensional array : Array Multi Dimension « Data Structure « VB.Net

Jagged two-dimensional array

Jagged two-dimensional array
Imports System

Public Class MainClass

    Shared Sub Main(ByVal args As String())
      Dim i, j As Integer

      ' jagged two-dimensional array
      Dim array2 As Integer()() = New Integer(2)() {}
      array2(0) = New Integer() {1, 2}
      array2(1) = New Integer() {3}
      array2(2) = New Integer() {4, 5, 6}

      Console.WriteLine( "Values in array2 by row are ")

      For i = 0 To array2.GetUpperBound(0)

         For j = 0 To array2(i).GetUpperBound(0)
            Console.WriteLine( array2(i)(j) )

    End Sub
End Class


Related examples in the same category

1.Initializing a jagged array, one in which the length of each array differsInitializing a jagged array, one in which the length of each array differs
2.Define and initialize the multi-dimensional arrayDefine and initialize the multi-dimensional array
3.Seclare a 4x3 Integer arraySeclare a 4x3 Integer array
4.Array Performance Test: Two-dimensional arrayArray Performance Test: Two-dimensional array
5.Array Performance Test: Two-dimensional Array and SetValue(i, i)Array Performance Test: Two-dimensional Array and SetValue(i, i)
6.Two Dimensional Rectangle ArrayTwo Dimensional Rectangle Array
7.Define and Init two dimensional arrayDefine and Init two dimensional array
8.Initializing multidimensional arrays: rectangular two-dimensional arrayInitializing multidimensional arrays: rectangular two-dimensional array
9.Two dimension array DemoTwo dimension array Demo
10.Array.SetValue for two-dimensional array
11.Array.SetValue for three-dimensional array
12.Array.SetValue for a seven-dimensional array
13.Clear multi-dimensional array