Reputation: 2454
I have:
double[,] table = new double[3,4];
How to check both sizes of that table? table.Length
gives me 12
which is total number of elements in table.
Upvotes: 3
Views: 171
Reputation: 60694
Use the GetLength
method.
So table.GetLength(0)
will return 3 and table.GetLength(1)
will return 4.
The parameter for GetLength
is the zero-based dimension of the array you want to know the length of.
Upvotes: 8
Reputation: 2974
Table.GetLength(0);
gives you 3
Table.GetLength(1);
gives you 4
Hope this helps.
Upvotes: 5