Name
CaseInsensitiveComparer
Synopsis
This type provides a means
for case-insensitive
comparison of string objects. This class implements the
IComparer.Compare( )
method. You can obtain a
standard comparer that uses the
System.Globalization.InvariantCulture
rules for
string comparisons by using the
CaseInsensitiveComparer
instance returned from the
static DefaultInvariant
property.
public class CaseInsensitiveComparer : IComparer { // Public Constructors public CaseInsensitiveComparer( ); public CaseInsensitiveComparer(System.Globalization.CultureInfoculture
); // Public Static Properties public static CaseInsensitiveComparer Default{get; } public static CaseInsensitiveComparer DefaultInvariant{get; } // Public Instance Methods public int Compare(objecta
, objectb
); // implements IComparer }
Get C# in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.