Record equality override only for base members
I have a record type B that inherits from another record type A, I want to make it so type A's members are not considered for equality, only subtype members. If I override the equality method in the base class, will autogenerated ones in subclasses call
base
? Or does the entire equality get redefined every time?2 Replies
https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQMwAIBOBTAxge02HQGF0BvZda9KmgSwDsAXdAQQvQHNtmBudAGdefAL51qE9GnQA3epmYBXAIYAbdACN8+DQFEAjqrWCAFGXzMAFtkwBKctIDs6ZpiXYxU8UmQycBEToACLoIKQUUkysAEKcPPxCIqK0SDTookA===
This seems to suggest it will work as I hope
SharpLab
C#/VB/F# compiler playground.
Remember to also implement
int GetHashCode() => 0
so it's disregarded foor hashsets.