Collections/arrays inside of records #4122
Unanswered
eduherminio
asked this question in
Q&A
Replies: 1 comment
-
The LDT decided that addressing all the possible ways of doing equality with records was not practical in the language. Instead the equality can be overridden, either manually or using the new Source Generators to generate equality for you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Given
I really want all these use cases to work:
I'm tempted of using:
so that this test passes
However, that's going to end up backfiring because of the
GetHashCode()
implementation, for instance here:So my real debate is between:
Equals()
, but being well aware of the limitations of the comparisons.I'm not asking for any specific answer, since it obviously depends on the context and specific use case of these classes, but has anyone faced similar dilemmas or thought about this situations with
record
classes in mind?Any other 'gotchas' while using records with
System.Generic.Collections
?Beta Was this translation helpful? Give feedback.
All reactions