This documentation is archived and is not being maintained.

IComparer Interface

Exposes a method that compares two objects.

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

[Visual Basic]
Public Interface IComparer
public interface IComparer
public __gc __interface IComparer
public interface IComparer

Classes that Implement IComparer

Class Description
CaseInsensitiveComparer Compares two objects for equivalence, ignoring the case of strings.
Comparer Compares two objects for equivalence, where string comparisons are case-sensitive.
KeysConverter Provides a TypeConverter to convert Keys objects to and from other representations.


This interface is used in conjunction with the Array.Sort and Array.BinarySearch methods. It provides a way to customize the sort order of a collection.

The default implementation of this interface is the Comparer class.

Comparison procedures use the Thread.CurrentCulture of the current thread unless otherwise specified. String comparisons might have different results depending on the culture. For more information on culture-specific comparisons, see the System.Globalization namespace and Developing World-Ready Applications.


Namespace: System.Collections

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

IComparer Members | System.Collections Namespace | Comparer | Thread.CurrentCulture | System.Globalization.CompareInfo | System.Globalization.CultureInfo