VB.net Program to Demonstrate the 3d Array

You are currently viewing VB.net Program to Demonstrate the 3d Array

VB.Net program to demonstrate the 3D array

'VB.Net program to demonstrate the 3D array.

Module Module1

    Sub Main()
        ' Three Dimensional Array
        Dim ThreeDArray As Integer(,,) = New Integer(1, 1, 2) {{{1, 2, 3}, {4, 5, 6}}, {{7, 8, 9}, {10, 11, 12}}}

        Console.WriteLine("3D Array Elements")
        Console.WriteLine("=================")
        For i As Integer = 0 To 1
            For j As Integer = 0 To 1
                For k As Integer = 0 To 2
                    Console.WriteLine("ThreeDArray[{0},{1},{2}] = {3}", i, j, k, ThreeDArray(i, j, k))
                Next
            Next
        Next
    End Sub
    
End Module
3D Array Elements
=================
ThreeDArray[0,0,0] = 1
ThreeDArray[0,0,1] = 2
ThreeDArray[0,0,2] = 3
ThreeDArray[0,1,0] = 4
ThreeDArray[0,1,1] = 5
ThreeDArray[0,1,2] = 6
ThreeDArray[1,0,0] = 7
ThreeDArray[1,0,1] = 8
ThreeDArray[1,0,2] = 9
ThreeDArray[1,1,0] = 10
ThreeDArray[1,1,1] = 11
ThreeDArray[1,1,2] = 12
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply