Most C# developers understand that there’s a difference between a “rectangular” and a “ragged” two-dimensional array.
int[,] rectangle = {
{10, 20},
{30, 40},
{50, 60} };
int[][] ragged = {
new[] {10},
new[] {20, 30},
new[] {40, 50, 60} };
Here we have a two-dimensional array with six elements, arranged in three rows of two elements each. And we have a one-dimensional array with three elements, where each element is itself a one-dimensional array with one, two or three elements.
That’s all very straightforward. Where things get brain-destroying is when you try to make a ragged array of two-dimensional arrays. Continue reading