Inheritable types should generally not implement IEquatable<T>
. If IEquatable<T>
included a GetHashCode()
method, one could define the semantics of IEquatable<T>
to say that items should compare equal when examined as T's. Unfortunately, the fact that IEquatable<T>
is bound to the same hash code as Object.Equals
means that in general IEquatable<T>
has to implement essentially the same semantics as Object.Equals
.
Consequently, if an implementation of IEquatable<BaseClass>
does anything other than call Object.Equals
within it, a derived class which overrides Object.Equals
and GetHashCode()
and does not re-implement IEquatable<BaseClass>
will end up with a broken implementation of that interface; an implementation of IEquatable<BaseClass>
which simply calls Object.Equals
will work just fine, even in that scenario, but will offer no real advantage over a class which doesn't implement IEquatable<T>
.
Given that inheritable classes shouldn't be implementing IEquatable<T>
in the first place, the notion of covariance is not relevant to proper implementations of the interface.