I just had one of these "What the..." moments. Is the following intended and is there some obscure reasoning behind the "non-natural" declaration of arrays in C#?
int[,][] i; // declares an 2D - array where each element is an int[] !
// you have to use it like this:
i = new int[2,3][];
i[1,2] = new int[0];
I would have expected the other way around. int[,][] declares an 1-dimensional array where each element is a two dimensional array.
Funny though, the type's Name is reversed:
Console.WriteLine(typeof(int[,][]).Name); // prints "Int32[][,]"
Can someone explain this? Is this intentionally? (Using .NET 4.5 under Windows.)