Create Comparer using the specified System.Globalization.CultureInfo in CSharp

Description

The following code shows how to create Comparer using the specified System.Globalization.CultureInfo.

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 = "aabe";

      Comparer myCompIntl = new Comparer( new CultureInfo( "es-ES", false ) );
      Console.WriteLine( "   International Sort: {0}", myCompIntl.Compare( str1, str2 ) );

   }

}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary