2-D and 3-D Arrays

Let's learn how to manage the dimensions of arrays in C#.

We'll cover the following

2-D arrays

Multidimensional arrays can be useful. The example below shows a two-dimensional array for a game map. Two values are needed for a 2-D array (row and column). Indicate a 2-D array by entering a comma between the square brackets.

Example: Declare a 2-D array

string [,] myGameMap = new string [,]
{
  // Empty 2D array
};

Get hands-on with 1200+ tech skills courses.