In a rectangular two-dimensional array, the first index selects the row and the second selects the column. An array’s first dimension reports the number of rows and its second dimension reports columns. Use GetLength(0) and GetLength(1) to ask C# for those counts.
int[,] seats = new int[2, 3];
int rows = seats.GetLength(0);
int columns = seats.GetLength(1);
seats[1, 2] = 7;Rows is 2 and columns is 3. The assignment reaches the last position in the second row. seats[2, 1] would be invalid because there is no row index 2, even though column index 2 is valid.
Think of the pair as a coordinate, not a single running index. Moving one column right changes only the second number; moving one row down changes only the first. For the 2 by 3 grid, the position [1,2] is valid, while [2,1] is not. Check each dimension against its own length.
Draw a two-row, three-column grid and label the six valid coordinate pairs. Then identify which dimension changes when moving horizontally across one row.