C# StringComparer CurrentCulture
Description
StringComparer CurrentCulture
gets a StringComparer
object that performs a case-sensitive string comparison using the word
comparison rules of the current culture.
Syntax
StringComparer.CurrentCulture
has the following syntax.
public static StringComparer CurrentCulture { get; }
Example
The following code example demonstrates the properties and the Create method of the StringComparer class.
using System;//from www .j a va2 s. com
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.InvariantCulture;
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.