4 ms·
Structs are mutable value types. Record types would let you define objects with public getters only and constructor that assigns them and a fancy syntax for cre
by rubber_duck 10y ago
Structs are mutable value types. Record types would let you define objects with public getters only and constructor that assigns them and a fancy syntax for creating a new object based on an existing record value + new property values, I think something like
Point a = b with {X = 0}
this will make using immutable record types in C# much less tedious. Will also implement other stuff like value equality override, etc. I wish this was in 7.0, this is a great way to do FP in C# when you can't use F#.
Proposal link :
https://github.com/dotnet/roslyn/blob/features/records/docs/features/records.md https://github.com/dotnet/roslyn/blob/features/records/docs/...