My question is about equality on reference types. Most ms docs state that full equality contract should be implemented only for objects having value semantics, although examples usually talk about things like complex numbers. Records are just glorified classes with multiple properties and have that implemented too. By full equality contract I mean
object.Equals
object.Equals
+
GetHashCode
GetHashCode
+
IEquatable
IEquatable
+ operators. Docs on
IEquatable<T>
IEquatable<T>
say that if you implement it you should also implement operators. Docs for object.Equals say that most reference types shouldn't override operators even if they implement equals. Why would a type implement Equals but not operators and not IEquatable<T>? Ah, and there is even an analyzer warning about implementing operators.