C# Comparer Default

Description

Comparer Default represents an instance of Comparer that is associated with the Thread.CurrentCulture of the current thread. This field is read-only.

Syntax

Comparer.Default has the following syntax.


public static readonly Comparer Default

Example


using System;//from w  w w .  java  2  s.co m
using System.Collections;
using System.Globalization;


public class SamplesComparer  {

   public static void Main()  {
      String str1 = "abc";
      String str2 = "aabc";

      Console.WriteLine(Comparer.Default.Compare( str1, str2 ) );

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack