The general form of a multidimensional array declaration:
type[, ...,] name = new type[size1, size2, ..., sizeN];
The general form of array initialization for a two-dimensional array is shown here:
type[,] array_name = { { val, val, val, ..., val }, { val, val, val, ..., val }, . . . { val, val, val, ..., val } };
using System; class MainClass { static void Main() { int[,] arr = new int[2, 3] { { 0, 1, 2 }, { 10, 11, 12 } }; for (int i = 0; i < 2; i++){ for (int j = 0; j < 3; j++){ Console.WriteLine(arr[i, j]); } } } }
0 1 2 10 11 12