Related questions
How do I find the size of a 2D array?
If I declare this array...
string[,] a = {
{"0", "1", "2"},
{"0", "1", "2"},
{"0", "1", "2"},
{"0", "1", "2"},
};
Then I can measure the length with
a.Length
which is 12. How do I measure the dimension of the arrays within? If I try...
a[0].Length
I get Wrong number of indices inside []; …
How to get a dimension (slice) from a multidimensional array
I'm trying to figure out how to get a single dimension from a multidimensional array (for the sake of argument, let's say it's 2D), I have a multidimensional array:
double[,] d = new double[,] { { 1, 2, 3, 4, 5 }, { 5, 4, 3, 2, 1 } };
If it was a jagged array, I …
Why do C# multidimensional arrays not implement IEnumerable<T>?
I have just noticed that a multidimensional array in C# does not implement IEnumerable<T>, while it does implement IEnumerable. For single-dimensional arrays, both IEnumerable<T> and IEnumerable are implemented.
Why this difference? If a multi-dimensional …