# Equality Operators

This section discusses overloading equality operators and refers to operator== and operator!= as equality operators.

❌ DO NOT overload one of the equality operators and not the other.

✔️ DO ensure that Object.Equals and the equality operators have exactly the same semantics and similar performance characteristics.

This often means that Object.Equals needs to be overridden when the equality operators are overloaded.

❌ AVOID throwing exceptions from equality operators.

For example, return false if one of the arguments is null instead of throwing NullReferenceException.

## Equality Operators on Value Types

✔️ DO overload the equality operators on value types, if equality is meaningful.

In most programming languages, there is no default implementation of operator== for value types.