Initializers "Update" #1639
Replies: 7 comments
-
That code doesn't seem at all readable or clear. |
Beta Was this translation helpful? Give feedback.
-
Maybe this could be better? with people {
Age = "M",
Date = "2018/06/15"
}; |
Beta Was this translation helpful? Give feedback.
-
Do you mean the C# 8.0's candidate #162? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Very good solution liked
`` |
Beta Was this translation helpful? Give feedback.
-
I'd love the former, if it means I can have an immutable type and then get a new instance back with just the specified member changed. |
Beta Was this translation helpful? Give feedback.
-
Reminds me of the with statement in Pascal and JavaScript. Something like this would be interesting, although I think I'd prefer it only be available for setting fields and properties (similar to the already existing object initializers.) (As opposed to the Pascal and JavaScript implementations where you're essentially changing That being said, the number of times I've wanted something like this have been pretty limited. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My idea is that an upgrade initializer would be possible to save code lines
Initializers
//Update object
//Output
Beta Was this translation helpful? Give feedback.
All reactions