I would like to override .Equals and the == operator for a class. I need to check whether there are any equality comparisons in use anywhere for that class at the moment. How would I do this?
I would like to override .Equals and the == operator for a class. I
Share
In both cases, I would add the overload/override, and then use “Find Usages” (in Resharper), or “View Call Hierarchy” (Visual Studio native). If anything shows up, it will be a change.
Another approach (if neither is available) is to (just while doing this) add
[Obsolete]to the override/overload methods you add – then any code that starts using them (i.e. has a change to behaviour) will show up as a warning.Caveat: if the
override(Equals) is part of an inheritance chain that already overridesEquals, note that code referencing the base-class will not appear in any of the above. This includes code usingobject.