Collection expression for multi-dimensional arrays #7871
Replies: 2 comments 3 replies
-
I believe the original proposal of collection expression did mention this, but said this is not possible. This syntax was already assigned for jagged array. |
Beta Was this translation helpful? Give feedback.
-
There hasn't been motivation thus far for multidimensional collection expressions. When we get natural types, I'd expect There's a lack of obvious wins that have been identified here. You mentioned spreads: What code should the compiler generate to spread something into a multidimensional array, and how can this be at least as efficient as existing methods of initializing multidimensional arrays? What should happen when things of unequal length are spread? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Just noticed that MD array is supported by traditional collection initializer:
But not collection expression:
The potential benefit of collection expression is allowing spreads. However, MD array requires the length are the same for each dimensions. Length difference need to be handled at runtime, if dynamic length with spreads is introduced.
Has this been discussed before?
Beta Was this translation helpful? Give feedback.
All reactions