mscorlib(4.0.0.0) API with additions
System.Collections.Comparer Class Reference

Compares two objects for equivalence, where string comparisons are case-sensitive. More...

Inheritance diagram for System.Collections.Comparer:
[legend]
Collaboration diagram for System.Collections.Comparer:
[legend]

Public Member Functions

 Comparer (CultureInfo culture)
 Initializes a new instance of the T:System.Collections.Comparer class using the specified T:System.Globalization.CultureInfo. More...
 
int Compare (object a, object b)
 Performs a case-sensitive comparison of two objects of the same type and returns a value indicating whether one is less than, equal to, or greater than the other. More...
 
void GetObjectData (SerializationInfo info, StreamingContext context)
 Populates a T:System.Runtime.Serialization.SerializationInfo object with the data required for serialization. More...
 

Static Public Attributes

static readonly Comparer Default = new Comparer(CultureInfo.CurrentCulture)
 Represents an instance of T:System.Collections.Comparer that is associated with the P:System.Threading.Thread.CurrentCulture of the current thread. This field is read-only. More...
 
static readonly Comparer DefaultInvariant = new Comparer(CultureInfo.InvariantCulture)
 Represents an instance of T:System.Collections.Comparer that is associated with P:System.Globalization.CultureInfo.InvariantCulture. This field is read-only. More...
 

Detailed Description

Compares two objects for equivalence, where string comparisons are case-sensitive.

Definition at line 11 of file Comparer.cs.

Constructor & Destructor Documentation

◆ Comparer()

System.Collections.Comparer.Comparer ( CultureInfo  culture)

Initializes a new instance of the T:System.Collections.Comparer class using the specified T:System.Globalization.CultureInfo.

Parameters
cultureThe T:System.Globalization.CultureInfo to use for the new T:System.Collections.Comparer.
Exceptions
T:System.ArgumentNullExceptionculture is null.

Definition at line 32 of file Comparer.cs.

Member Function Documentation

◆ Compare()

int System.Collections.Comparer.Compare ( object  a,
object  b 
)

Performs a case-sensitive comparison of two objects of the same type and returns a value indicating whether one is less than, equal to, or greater than the other.

Parameters
aThe first object to compare.
bThe second object to compare.
Returns
A signed integer that indicates the relative values of a and b , as shown in the following table.Value Meaning Less than zero a is less than b . Zero a equals b . Greater than zero a is greater than b .
Exceptions
T:System.ArgumentExceptionNeither a nor b implements the T:System.IComparable interface.-or- a and b are of different types and neither one can handle comparisons with the other.

Implements System.Collections.IComparer.

Definition at line 64 of file Comparer.cs.

◆ GetObjectData()

void System.Collections.Comparer.GetObjectData ( SerializationInfo  info,
StreamingContext  context 
)

Populates a T:System.Runtime.Serialization.SerializationInfo object with the data required for serialization.

Parameters
infoThe object to populate with data.
contextThe context information about the source or destination of the serialization.
Exceptions
T:System.ArgumentNullExceptioninfo is null.

Implements System.Runtime.Serialization.ISerializable.

Definition at line 106 of file Comparer.cs.

Member Data Documentation

◆ Default

readonly Comparer System.Collections.Comparer.Default = new Comparer(CultureInfo.CurrentCulture)
static

Represents an instance of T:System.Collections.Comparer that is associated with the P:System.Threading.Thread.CurrentCulture of the current thread. This field is read-only.

Definition at line 16 of file Comparer.cs.

◆ DefaultInvariant

readonly Comparer System.Collections.Comparer.DefaultInvariant = new Comparer(CultureInfo.InvariantCulture)
static

Represents an instance of T:System.Collections.Comparer that is associated with P:System.Globalization.CultureInfo.InvariantCulture. This field is read-only.

Definition at line 19 of file Comparer.cs.


The documentation for this class was generated from the following file: