Multi-dimensional arrays
suggest changeArrays can have more than one dimension. The following example creates a two-dimensional array of ten rows and ten columns:
int[,] arr = new int[10, 10];
An array of three dimensions:
int[,,] arr = new int[10, 10, 10];
You can also initialize the array upon declaration:
int[,] arr = new int[4, 2] { {1, 1}, {2, 2}, {3, 3}, {4, 4} };
// Access a member of the multi-dimensional array:
Console.Out.WriteLine(arr[3, 1]); // 4
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents