3 ms·
> C# to add loads and loads of syntactic sugar well some is necessary. example: init-only-Setter, was impossible to do before. You could not write the same Cod
by merb 6y ago
> C# to add loads and loads of syntactic sugar
well some is necessary.
example: init-only-Setter, was impossible to do before. You could not write the same Code, without it. No matter what you did.
using declarations where also necessary to increase readability.
and nullable reference types also were important!
- jayd16 6y agoYou could use an explicit private readonly field and a property getter, or even just a public readonly field. I would argue its only sugar.
- ygra 6y agoIt doesn't scale that well, as you need ctor parameters for every property, so API additions may also be breaking changes.
- 9wzYQbTYsAIc 6y agoAre you referring to the init only setters? If so, it isn’t just sugar, they added a new hook for it in the internals, rather than just relabelling a technique to accomplish a similar (but not equal) end.
- merb 6y agowell that would be different to instantiate tough. it would be Class(1, 2, 3) instead of Class { Value1=1, Value2=2, Value3=3, } actually record types are more syntactic sugar around what you said than initonly, which opens up a new way of writing code