Compartir a través de


IComparable.CompareTo Method

Compares the current instance (object) with another object of the same type.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

public int CompareTo (
         Object obj
)

Parameters

  • obj
    The object you want to compare with the current object.

Return Value

A 32-bit signed integer that indicates the relative order of the comparands. The return value has one of the three meanings described in the following table.

Value Meaning
Less than 0 (zero) This object is less than the obj parameter.
0 (zero) This object is equal to the obj parameter.
Greater than 0 (zero) This object is greater than the obj parameter.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

IComparable Interface
IComparable Members
System Namespace