BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 System.Runtime.InteropServices.ComVisible(true)

This interface is implemented by types whose values can be ordered or sorted. It requires that implementing types define a single method, , that indicates whether the position of the current instance in the sort order is before, after, or the same as a second object of the same type. The instance's implementation is called automatically by methods such as and .

The implementation of the method must return an that has one of three values, as shown in the following table.

Value

Meaning

Less than zero

The current instance precedes the object specified by the method in the sort order.

Zero

This current instance occurs in the same position in the sort order as the object specified by the method.

Greater than zero

This current instance follows the object specified by the method in the sort order.

All numeric types (such as and ) implement , as do , , and . Custom types should also provide their own implementation of to enable object instances to be ordered or sorted.

Defines a generalized type-specific comparison method that a value type or class implements to order or sort its instances.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  The method is implemented by types whose values can be ordered or sorted. It is called automatically by methods of non-generic collection objects, such as , to order each member of the array. If a custom class or structure does not implement , its members cannot be ordered and the sort operation can throw an .

  This method is only a definition and must be implemented by a specific class or value type to have effect. The meaning of the comparisons specified in the Return Value section ("precedes", "occurs in the same position as", and "follows") depends on the particular implementation.

  By definition, any object compares greater than (or follows) null, and two null references compare equal to each other.

  The parameter, , must be the same type as the class or value type that implements this interface; otherwise, an is thrown.

  Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

  A value that indicates the relative order of the objects being compared. The return value has these meanings:

  Value

  Meaning

  Less than zero

  This instance precedes in the sort order.

  Zero

  This instance occurs in the same position in the sort order as .

  Greater than zero

  This instance follows in the sort order.

  An object to compare with this instance. 0
0