Records: Automatically generate EqualityComparer #3790
Answered
by
theunrepentantgeek
TonyValenti
asked this question in
Language Ideas
-
Since records are already generating compare methods, it would be nice if they also automatically generated an EqualityComparer class similar to what I show below:
|
Beta Was this translation helpful? Give feedback.
Answered by
theunrepentantgeek
Aug 11, 2020
Replies: 1 comment
-
For any type |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YairHalberstadt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For any type
Foo
that implementsIEquatable<Foo>
you can useEqualityComparer<Foo>.Default
to get an instance ofIEqualityComparer<Foo>
for that type; I don't think records need to implement their own.