Replies: 3 comments 5 replies
-
This sounds great, but is there a proposal for how to actually do this? If the C# compiler isn't generating Equals then what option do you have at runtime besides reflection?
+1 for record structs having mutable public properties like tuples. Not only does it give you a tuple with a name, but it would also solve the problem of tuples not being reflection friendly because the property names are compile time only. |
Beta Was this translation helpful? Give feedback.
-
I opened a proposal on dotnet runtime recently suggesting that tiered compilation be used to optimise struct equality if used on a hot path: dotnet/runtime#36613 |
Beta Was this translation helpful? Give feedback.
-
Will Also, -1 for making positional record structs mutable. Different behavior between record classes and structs will be too confusing, especially if you add primary constructors to regular structs and classes later. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/dotnet/csharplang/blob/master/meetings/2020/LDM-2020-09-30.md
Agenda
record structs
struct
equalitywith
expressionsdata
propertiesBeta Was this translation helpful? Give feedback.
All reactions