CaseInsensitiveHashCodeProvider Class

CaseInsensitiveHashCodeProvider Class

 
obsoleteCodeEntityT:System.StringComparerNote: This API is now obsolete.

Supplies a hash code for an object, using a hashing algorithm that ignores the case of strings.

Namespace:   System.Collections
Assembly:  mscorlib (in mscorlib.dll)

System.Object
  System.Collections.CaseInsensitiveHashCodeProvider

[<SerializableAttribute>]
[<ObsoleteAttribute("Please use StringComparer instead.")>]
[<ComVisibleAttribute(true)>]
type CaseInsensitiveHashCodeProvider = 
    class
        interface IHashCodeProvider
    end

NameDescription
System_CAPS_pubmethodCaseInsensitiveHashCodeProvider()

Initializes a new instance of the CaseInsensitiveHashCodeProvider class using the Thread.CurrentCulture of the current thread.

System_CAPS_pubmethodCaseInsensitiveHashCodeProvider(CultureInfo)

Initializes a new instance of the CaseInsensitiveHashCodeProvider class using the specified System.Globalization.CultureInfo.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticDefault

Gets an instance of CaseInsensitiveHashCodeProvider that is associated with the Thread.CurrentCulture of the current thread and that is always available.

System_CAPS_pubpropertySystem_CAPS_staticDefaultInvariant

Gets an instance of CaseInsensitiveHashCodeProvider that is associated with CultureInfo.InvariantCulture and that is always available.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetHashCode(Object)

Returns a hash code for the given object, using a hashing algorithm that ignores the case of strings.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

CaseInsensitiveHashCodeProvider implements the IHashCodeProvider interface supporting case-insensitive comparisons on strings, just as CaseInsensitiveComparer implements the IComparer interface supporting case-insensitive comparisons on strings.

The objects used as keys by a Hashtable are required to override the Object.GetHashCode method (or the IHashCodeProvider interface) and the Object.Equals method (or the IComparer interface). The implementation of both methods or interfaces must handle case sensitivity the same way; otherwise, the Hashtable might behave incorrectly. For example, when creating a Hashtable, you must use this class with the CaseInsensitiveComparer class or any case-insensitive IComparer implementation.

The following code example creates a case-sensitive hash table and a case-insensitive hash table and demonstrates the difference in their behavior, even if both contain the same elements.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft