2
Reply

Arrays mutlidimension

harish reddy

harish reddy

Nov 22 2017 9:53 AM
109
int[,] matrix =
{
{1, 2, 3, 4},
{5, 6, 7, 8},
};
We can get the number of the rows of this two-dimensional array by using matrix.GetLength(0) and the number of all columns per row with matrix.GetLength(1). So, in this case matrix.GetLength(0) returns 2 and matrix.GetLength(1) returns 4.
 
Can you explain why the result is 2 and 4? 

Answers (2)