Essential C# Arrays  Suggest an edit

Multi-dimensional arrays

Arrays 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

Table Of Contents
20 Arrays
22 Enum
25 GUID
107 Stream
108 Timers
  ↑ ↓ to navigate     ↵ to select     Esc to close