The Labs \ Source Viewer \ SSCLI \ System \ IComparable

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace System
  16. {
  17.    
  18.     using System;
  19.     // The IComparable interface is implemented by classes that support an
  20.     // ordering of instances of the class. The ordering represented by
  21.     // IComparable can be used to sort arrays and collections of objects
  22.     // that implement the interface.
  23.     //
  24.     [System.Runtime.InteropServices.ComVisible(true)]
  25.     public interface IComparable
  26.     {
  27.         // Interface does not need to be marked with the serializable attribute
  28.         // Compares this object to another object, returning an integer that
  29.         // indicates the relationship. An implementation of this method must return
  30.         // a value less than zero if this is less than object, zero
  31.         // if this is equal to object, or a value greater than zero
  32.         // if this is greater than object.
  33.         //
  34.         int CompareTo(object obj);
  35.     }
  36.    
  37.     // Generic version of IComparable.
  38.    
  39.     public interface IComparable<T>
  40.     {
  41.         // Interface does not need to be marked with the serializable attribute
  42.         // Compares this object to another object, returning an integer that
  43.         // indicates the relationship. An implementation of this method must return
  44.         // a value less than zero if this is less than object, zero
  45.         // if this is equal to object, or a value greater than zero
  46.         // if this is greater than object.
  47.         //
  48.         int CompareTo(T other);
  49.     }
  50. }

Developer Fusion