System.Collections.Generic.Comparer<T> Class

Provides a base class for implementations of the IComparer`1 generic interface.

See Also: Comparer<T> Members

Syntax

public abstract class Comparer<T> : IComparer<T>, IComparer

Type Parameters

T
Documentation for this section has not yet been entered.

Remarks

Derive from this class to provide a custom implementation of the IComparer`1 interface for use with collection classes such as the SortedList`2 and SortedDictionary`2 generic classes.

The difference between deriving from the Comparer`1 class and implementing the IComparable interface is as follows:

The object returned by the Comparer`1.Default property uses the IComparable`1 generic interface (IComparable<T> in C#, IComparable(Of T) in Visual Basic) to compare two objects. If type T does not implement the IComparable`1 generic interface, the Comparer`1.Default property returns a Comparer`1 that uses the IComparable interface.

Requirements

Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0