System.Collections.Hashtable.GetHash Method

Returns the hash code for the specified key.

Syntax

protected virtual int GetHash (object key)

Parameters

key
The object for which a hash code is to be returned.

Returns

The hash code for key.

Exceptions

TypeReason
ArgumentNullException key is null.

Remarks

If the hash table was created with a specific IHashCodeProvider implementation, this method uses that hash code provider; otherwise, it uses the object.GetHashCode implementation of key.

This method is an O(1) operation.

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0