- o1.Equals(o2) - equality
- By default, true if o1 and o2 are created by execution of the same new
- Can be redefined in a particular class
- Object.ReferenceEquals(o1, o2) - identity
- True if both o1 and o2 are null, or if they are created by execution of the same new
- Static - cannot be redefined.
- Object.Equals(o1, o2)
- True if Object.ReferenceEquals(o1, o2), or if o1.Equals(o2)
- o1 == o2
- True if both o1 and o2 are null, or if they are created by execution of the same new
- An overloadable operator
Friday, August 3, 2018
Equality in C#
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment