IComparer.cs 792 B

1234567891011121314151617181920
  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. namespace System.Collections
  5. {
  6. // The IComparer interface implements a method that compares two objects. It is
  7. // used in conjunction with the Sort and BinarySearch methods on
  8. // the Array and List classes.
  9. //
  10. // Interfaces are not serializable
  11. public interface IComparer
  12. {
  13. // Compares two objects. An implementation of this method must return a
  14. // value less than zero if x is less than y, zero if x is equal to y, or a
  15. // value greater than zero if x is greater than y.
  16. //
  17. int Compare(object? x, object? y);
  18. }
  19. }