.NET Framework Class Library  

Hashtable.GetHash Method

Returns the hash code for the specified key.

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

Parameters

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

Return Value

The hash code for key.

Exceptions

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

Remarks

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.

Requirements

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 - Windows CE .NET, Common Language Infrastructure (CLI) Standard

See Also

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