C
C#2w ago
Carsillas

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
SleepWellPupper
Remember to also implement int GetHashCode() => 0 so it's disregarded foor hashsets.

Did you find this page helpful?