Thursday, May 22, 2008

The length of a multi dimensional array

This is a note to myself so that I'll remember how to get the length of a single dimension of a multi dimensional array in C#.

string[,] array = { {"a", "a", "a"}, {"b", "b", "b"} };

array.GetLength(0);
// Returns 2

array.GetLength(1);
// Returns 3
 

No comments:

Post a Comment