GetHashCode

The method that returns a number summarising an object, used by hash-based collections such as Dictionary and HashSet to find it quickly.

In more detail

Equal objects must return equal hash codes, so if you override Equals you must override GetHashCode from the same members. Otherwise equal objects land in different buckets and never find each other.

Related terms

Taught in

References