This documentation is archived and is not being maintained.

IHashCodeProvider.GetHashCode Method

Returns a hash code for the specified object.

[Visual Basic]
Function GetHashCode( _
   ByVal obj As Object _
) As Integer
int GetHashCode(
   object obj
int GetHashCode(
   Object* obj
function GetHashCode(
   obj : Object
) : int;


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

Return Value

A hash code for the specified object.


Exception Type Condition
ArgumentNullException The type of obj is a reference type and obj is a null reference (Nothing in Visual Basic).


The return value from this method must not be persisted for two reasons. First, the hash function of a class might be altered to generate a better distribution, rendering any values from the old hash function useless. Second, the default implementation of this class does not guarantee that the same value will be returned by different instances.


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

IHashCodeProvider Interface | IHashCodeProvider Members | System.Collections Namespace | Object.GetHashCode