I would like to determine the impact that a code change within on override of Equals() in my class would have on the code.
public override bool Equals(object obj)
{
// My code to be changed
return true;
}
When I do Shift-F12 to find all references, Visual Studio returns 126,703 places where I am calling object.Equals().
Is there a way to skip overrides of Equals() method when looking for references?
Because the
Equalsmethod is defined at anobjectlevel, an object of your class could easily be passed to a method that callsEqualsknowing nothing more than that it is anobject.For example, if you ever add your object to a HashSet, or if you call
.Distinct()on a collection that includes your object, then you will be indirectly invokingEquals.The only way to find all the places that overriding
Equalswill affect is to find all the places that your class is being used and see what is done with it.