Hi there, i can initialize a two dimensional array:
- int[,] myDimensional2 = new int[2, 3] { { 10, 20, 30 }, { 40, 50, 60} };
but i don't know how i can initialize a three, four,... dimensional arrays? :(
please initialize this array and give me the code, thank you so much :)
- int[,,] threeDimensional = new int[2, 2, 3];

Brajesh KumarPosted Mar 2, 2017, 9:27 AM
The array in your question has only one element, so you only need one value to completely initialise it. You need three sets of braces, one for each dimension of the array.
A clearer example might be:
As you can see, there are two groups, each containing three groups of 4 numbers.
intarr[3][3][3]={{{11, 12, 13},{14, 15, 16},{17, 18, 19}},{{21, 22, 23},{24, 25, 26},{27, 28, 29}},{{31, 32, 33},{34, 35, 36},{37, 38, 39}},};Nilesh ShahPosted Mar 2, 2017, 10:02 AM
Nilesh ShahPosted Mar 2, 2017, 9:36 AM