I implemented a IEqualityComparer<MyObject> for MyObject in order for my priority queue to be able to sort elements (the use does not really import here, but whatever).
Thus, I implemented the Equals and GetHashCode methods.
My question is: when I do MyObject1 == MyObject2, does it use the tests written by me in the Equals method or is it a classical equality test?
Assuming this is a reference type,
==will only perform any custom operations if you overload the == operator:The C# compiler doesn’t know about any relationship between the
Equalsmethod and the==operator, as far as I’m aware.