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 Equals
method is defined at an object
level, an object of your class could easily be passed to a method that calls Equals
knowing nothing more than that it is an object
.
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 invoking Equals
.
The only way to find all the places that overriding Equals
will affect is to find all the places that your class is being used and see what is done with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With