Coming from a perl background, I have always defined a 2D array using int[][]
. I know you can use int[,]
instead so what are the differences?
The difference here is that the first sample, int[][] creates a jagged array, while the second creates a rectangular array (of dimension 2). In a jagged array each "column" can be of a different size. In a true multidimensional array, each "column" (in a dimension) is the same size. For more complete information see the Array section of the C# Programming Guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With