C# StringComparer CurrentCultureIgnoreCase
Description
StringComparer CurrentCultureIgnoreCase
gets a StringComparer
object that performs case-insensitive string comparisons using the word
comparison rules of the current culture.
Syntax
StringComparer.CurrentCultureIgnoreCase
has the following syntax.
public static StringComparer CurrentCultureIgnoreCase { get; }
Example
using System;// w w w . ja va 2 s . c o m
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
class Sample
{
public static void Main()
{
List<string> list = new List<string>();
StringComparer invCmp = StringComparer.CurrentCultureIgnoreCase;
string capitalLetterI = "I";
string smallLetterI = "i";
string smallLetterDotlessI = "\u0131";
list.Add(capitalLetterI);
list.Add(smallLetterI);
list.Add(smallLetterDotlessI);
list.Sort(invCmp);
}
}
The code above generates the following result.