| 1 |
// ==++== |
| 2 |
// |
| 3 |
// Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 |
// |
| 5 |
// ==--== |
| 6 |
/*============================================================ |
| 7 |
** |
| 8 |
** Interface: IComparer |
| 9 |
** |
| 10 |
** <OWNER>kimhamil</OWNER> |
| 11 |
** |
| 12 |
** |
| 13 |
** Purpose: Interface for comparing two generic Objects. |
| 14 |
** |
| 15 |
** |
| 16 |
===========================================================*/ |
| 17 |
namespace System.Collections.Generic { |
| 18 |
|
| 19 |
using System; |
| 20 |
// The generic IComparer interface implements a method that compares |
| 21 |
// two objects. It is used in conjunction with the Sort and |
| 22 |
// BinarySearch methods on the Array, List, and SortedList classes. |
| 23 |
public interface IComparer<in T> |
| 24 |
{ |
| 25 |
// Compares two objects. An implementation of this method must return a |
| 26 |
// value less than zero if x is less than y, zero if x is equal to y, or a |
| 27 |
// value greater than zero if x is greater than y. |
| 28 |
// |
| 29 |
int Compare(T x, T y); |
| 30 |
} |
| 31 |
} |