This documentation is archived and is not being maintained.

CompareInfo Class

Implements a set of methods for culture-sensitive string comparisons.

For a list of all members of this type, see CompareInfo Members.


[Visual Basic]
Public Class CompareInfo
   Implements IDeserializationCallback
public class CompareInfo : IDeserializationCallback
public __gc class CompareInfo : public IDeserializationCallback
class CompareInfo implements IDeserializationCallback

Thread Safety

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


The CultureInfo class includes a CompareInfo property that is an instance of this class. String.Compare uses the information in CultureInfo.CompareInfo to compare strings.

Unlike most classes, CompareInfo provides the GetCompareInfo method, instead of public constructors, to allow for late-bound access.

To create a CompareInfo for any culture, use the CultureInfo.CompareInfo property, or use the GetCompareInfo method.

If a security decision depends on a string comparison or a case-change operation, use the InvariantCulture to ensure that the behavior will be consistent regardless of the culture settings of the system.


Namespace: System.Globalization

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

Assembly: Mscorlib (in Mscorlib.dll)

See Also

CompareInfo Members | System.Globalization Namespace