Create Comparer that is associated with CultureInfo.InvariantCulture in CSharp
Description
The following code shows how to create Comparer that is associated with CultureInfo.InvariantCulture.
Example
//from ww w . j a v a 2 s. c o m
using System;
using System.Collections;
using System.Globalization;
public class SamplesComparer {
public static void Main() {
String str1 = "abc";
String str2 = "aabc";
Console.WriteLine(Comparer.DefaultInvariant.Compare( str1, str2 ) );
Comparer myCompIntl = new Comparer( new CultureInfo( "es-ES", false ) );
Console.WriteLine(myCompIntl.Compare( str1, str2 ) );
}
}
The code above generates the following result.