TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  7@521Checked automatically with code checker

Synopsis:Override the Equals method whenever you implement the == operator, and make them do the same thing
Language:C#
Severity Level:1
Category:Object oriented


Description:

This allows infrastructure code such as Hashtable and ArrayList, which use the Equals method, to behave the same way as user code written using the equality operator.

Note:

For value types, the other way around applies also, i.e., whenever you override the Equals method, then also implement the equality operator.



Literature References:
MS Design Guidelines for Implementing Equals and the Equality Operator (==)