While implementing an == operator, I have the feeling that I am missing some essential points.
Hence, I am searching some best practices around that.
Here are some related questions I am thinking about:
- How to cleanly handle the reference comparison?
- Should it be implemented through a
IEquatable<T>-like interface? Or overridingobject.Equals? - And what about the
!=operator?
(this list might not be exhaustive).
I would follow Microsoft’s Guidelines for Overloading Equals() and Operator ==.
edit: Microsoft’s guidelines contain this important remark, which seems to confirm Henk’s answer: