This documentation is archived and is not being maintained.

Hashtable.GetHash Method

Returns the hash code for the specified key.

[Visual Basic]
Protected Overridable Function GetHash( _
   ByVal key As Object _
) As Integer
protected virtual int GetHash(
 object key
protected: virtual int GetHash(
 Object* key
protected function GetHash(
   key : Object
) : int;


The Object for which a hash code is to be returned.

Return Value

The hash code for key.


Exception Type Condition
NullReferenceException key is a null reference (Nothing in Visual Basic).


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


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Hashtable Class | Hashtable Members | System.Collections Namespace | Object.GetHashCode | Object | IHashCodeProvider