Replies: 3 comments 15 replies
-
I have long wished that I could use object initializer syntax to set (as opposed to add) elements in a dictionary. Whatever you decide, I hope you support both. Also, here is an interesting idea: What if you could call: And that told the compiler to call Xxx / XxxRange for each item/collection in the expression? |
Beta Was this translation helpful? Give feedback.
-
It's unfortunate that the "overwrite" semantics were chosen as the default, and that the possibility of supporting both approaches with 2 different syntaxes wasn't even considered. |
Beta Was this translation helpful? Give feedback.
-
I still don't get the use case of this feature. Collection expressions- sure hardcoding any arbitrary type of collection occurs often enough that its own syntax met the bar for inclusion in the language. But how often are people actually hard-coding dictionaries in their code? I've probably done this a handful of times in my entire career. I don't think this is worth spending design effort on or increasing language complexity for. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-03-11.md
Agenda
Beta Was this translation helpful? Give feedback.
All reactions