Example

using System;
using System.Collections;

namespace Samples
{
  public class ComparerSamples
  {
    public static void Main() 
    {
      Comparer c = Comparer.Default;
      string a = "apples", o = "oranges";
      Console.WriteLine(
        "Comparing {0} to {1} returns {2}",
        a, o, c.Compare(a, o));
    }
  }
}
The output is
Comparing apples to oranges returns -1

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.