❔ why is there a comma in the [] when working in a multidimensional array
im fairly advanced with c# but had no use to use multidimensional arrays for what im working on so i dont know why there is a comma like this
[ , ]
8 Replies
The comma specifies the dimensions of the array
[]
is one dimension, [,]
is two dimensions, [,,]
is three dimensions, etc.
The dimension is part of the type itselfalright
tanks
thanks
In the rare cases I've ever needed something like a multi-dimensional array, I actually find jagged arrays (arrays of arrays) much more intuitive. Plus, they are (very counterintuitively) faster!
And they also have way more standard library support.
What's an example?
Name one method in the BCL which uses 2d arrays
agreed
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.