Multidimensional Arrays in C#
•
•
Multidimensional arrays can be initialized when they are
declared:
int[,] myArray2D = new int[,] { { 1, 2 },
{
{
{
3, 4 },
5, 6 },
7, 8 } };
The data of an array can be retrieved by use an index:
Debug.Log(myArray2D[0, 0]);
Debug.Log(myArray2D[0, 1]);
Debug.Log(myArray2D[1, 0]);
Debug.Log(myArray2D[1, 1]);
Debug.Log(myArray2D[2, 0]);
Debug.Log(myArray2D[2, 1]);
Debug.Log(myArray2D[3, 0]);
Debug.Log(myArray2D[3, 1]);