Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IHashCodeProvider.GetHashCode Method

Returns a hash code for the specified object.

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

Parameters

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

Return Value

A hash code for the specified object.

Exceptions

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

Remarks

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.

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

See Also

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

Show:
© 2015 Microsoft