In the second edition of Effective C# (ISBN-13: 978-0321658708) on page 37, the book reads
The second function you'll never redefine is static Object.Equals()
However, on page 39, the book reads
The point is that if your type should follow value semantics (comparing contents) instead of reference semantics (comparing object identity), you should write your own override of instance Object.Equals()
Would someone be so kind as to explain why one would override
public virtual bool Equals(object right);
and not
public static bool Equals(object left, object right);
Thank you :)
Because you can't override a static method.
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