IComparer.cs 805 B

12345678910111213141516171819202122
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. namespace System.Collections
  6. {
  7. // The IComparer interface implements a method that compares two objects. It is
  8. // used in conjunction with the Sort and BinarySearch methods on
  9. // the Array and List classes.
  10. //
  11. // Interfaces are not serializable
  12. public interface IComparer
  13. {
  14. // Compares two objects. An implementation of this method must return a
  15. // value less than zero if x is less than y, zero if x is equal to y, or a
  16. // value greater than zero if x is greater than y.
  17. //
  18. int Compare(object x, object y);
  19. }
  20. }