[Serializable] |
The Comparer class is the default implementation of the IComparer interface and performs case-sensitive string comparisons.
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 the conceptual topic at MSDN: designingglobalapplications.
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the CaseInsensitiveComparer class using the Thread.CurrentCulture of the current thread. |
ctor #2 | Overloaded:.ctor(CultureInfo culture) Initializes a new instance of the CaseInsensitiveComparer class using the specified CultureInfo. |
Default | Read-only Gets an instance of CaseInsensitiveComparer that is always available. |
Compare | Performs a case-insensitive 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. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public CaseInsensitiveComparer(); |
public CaseInsensitiveComparer( |
culture
Exception Type | Condition |
---|---|
ArgumentNullException | culture is null. |
public static CaseInsensitiveComparer Default {get;}
|
a
b
Value | Condition |
---|---|
Less than zero | is less than , with casing ignored. |
Zero | equals , with casing ignored. |
Greater than zero | is greater than , with casing ignored. |
Exception Type | Condition |
---|---|
ArgumentException | Neither a nor b implements the IComparable interface. -or- a and b are of different types. |
Comparing null with any type is allowed and does not generate an exception when using IComparable. When sorting, null is considered to be less than any other object.
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 the conceptual topic at MSDN: designingglobalapplications.
~CaseInsensitiveComparer(); |
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |