EqualityComparer<T>.GetHashCode(T) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
When overridden in a derived class, serves as a hash function for the specified object for hashing algorithms and data structures, such as a hash table.
public:
abstract int GetHashCode(T obj);
public abstract int GetHashCode (T obj);
override this.GetHashCode : 'T -> int
Public MustOverride Function GetHashCode (obj As T) As Integer
Parameters
- obj
- T
The object for which to get a hash code.
Returns
A hash code for the specified object.
Implements
Exceptions
The type of obj
is a reference type and obj
is null
.
Notes to Implementers
Implementations are required to ensure that if the Equals(T, T) method returns true
for two objects x
and y
, then the value returned by the GetHashCode(T) method for x
must equal the value returned for y
.