System.Collections.IHashCodeProvider

Supplies a hash code for an object, using a custom hash function.

See Also: IHashCodeProvider Members

Syntax

[System.Obsolete("Please use IEqualityComparer instead.")]
[System.Runtime.InteropServices.ComVisible(true)]
public interface IHashCodeProvider

Remarks

The IHashCodeProvider interface is used in conjunction with the Hashtable class. The objects used as keys by a Hashtable object must override the object.GetHashCode and object.Equals(object) methods. object.GetHashCode or the key's implementation of object.GetHashCode is used as the hash code provider. object.Equals(object) or the key's implementation of object.Equals(object) is used as the comparer.

However, some overloads of the Hashtable constructor take a parameter that is an IHashCodeProvider implementation, or a parameter that is an IComparer implementation, or both. If an IHashCodeProvider implementation is passed to the constructor, the IHashCodeProvider.GetHashCode(object) method of that implementation is used as the hash code provider. If an IComparer implementation is passed to the constructor, the IComparer.Compare(object, object) method of that implementation is used as the comparer.

Requirements

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