CaseInsensitiveHashCodeProvider Class

Note: This API is now obsolete. The non-obsolete alternative is StringComparer.

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

System.Object
  System.Collections.CaseInsensitiveHashCodeProvider

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

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

The CaseInsensitiveHashCodeProvider type exposes the following members.

  NameDescription
Public methodSupported by the XNA FrameworkCaseInsensitiveHashCodeProvider()Initializes a new instance of the CaseInsensitiveHashCodeProvider class using the Thread.CurrentCulture of the current thread.
Public methodSupported by the XNA FrameworkCaseInsensitiveHashCodeProvider(CultureInfo)Initializes a new instance of the CaseInsensitiveHashCodeProvider class using the specified System.Globalization.CultureInfo.
Top

  NameDescription
Public propertyStatic memberSupported by the XNA FrameworkDefaultGets an instance of CaseInsensitiveHashCodeProvider that is associated with the Thread.CurrentCulture of the current thread and that is always available.
Public propertyStatic memberSupported by the XNA FrameworkDefaultInvariantGets an instance of CaseInsensitiveHashCodeProvider that is associated with CultureInfo.InvariantCulture and that is always available.
Top

  NameDescription
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetHashCode()Serves as the default hash function. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetHashCode(Object)Returns a hash code for the given object, using a hashing algorithm that ignores the case of strings.
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by the XNA FrameworkToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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

Supported in: 1.1, 1.0
Obsolete (compiler warning) in 4.5
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5.2
Obsolete (compiler warning) in 4
Obsolete (compiler warning) in 3.5
Obsolete (compiler warning) in 3.5 SP1
Obsolete (compiler warning) in 3.0
Obsolete (compiler warning) in 3.0 SP1
Obsolete (compiler warning) in 3.0 SP2
Obsolete (compiler warning) in 2.0
Obsolete (compiler warning) in 2.0 SP1
Obsolete (compiler warning) in 2.0 SP2

.NET Framework Client Profile

Obsolete (compiler warning) in 4
Obsolete (compiler warning) in 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft