@reed said:I think C# does what C and C++ do (though I don't know for sure and could be wrong):
[code]int[3][3] a = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };[/code]is really the same as: [code]int[9] a = {1, 2, 3, 4, 5, 6, 7, 8, 9};[/code]
except for the way that you index it using [].
Er.... that's neither valid C# code, nor valid C/C++ code. I can see what you meant, though, but I think you're on the wrong track.
In C#, the elements of a multidimensional array *are* all next to each other, just as if they had been laid out in a single array, and currently they're laid out as you specified (which, incidentally, is row-major order, making it compatible with C/C++). However, C# could easily change to column-major order, and elements would be laid out like this: {1,4,7,2,5,8,3,6,9}, making it compatible with Fortran and Matlab. In fact, MS should consider allowing the programmer to do it either way, since the arithmetic for indexing is pretty much the same either way.
Regardless, in C#, you *cannot* specify an array as multidimensional (using int [,] a = {...}) and then access it as if it were a single-dimension array (i.e. using a[i]). It won't compile.