Export (0) Print
Expand All

Comparer.Default Property

Returns a default sort order comparer for the type specified by the generic argument.

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

public static Comparer<T> Default { get; }
/** @property */
public static Comparer<T> get_Default ()

public static function get Default () : Comparer<T>

Not applicable.

Property Value

An object that inherits Comparer and serves as a sort order comparer for type T.

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

Notes to Callers: For string comparisons, the StringComparer class is recommended over Comparer<String> (Comparer(Of String) in Visual Basic). Properties of the StringComparer class return predefined instances that perform string comparisons with different combinations of culture-sensitivity and case-sensitivity. The case-sensitivity and culture-sensitivity are consistent among the members of the same StringComparer instance. For more information on culture-specific comparisons, see the System.Globalization namespace and Encoding and Localization.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2014 Microsoft