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.
'Declaration
Public Overloads Function CompareTo( _
ByVal As Length _
) As Integer
Parameters
- other
- An System.Object to compare with this instance.
Return Value
An System.Int32 value indicating the relative order of the objects being compared.
Less than zero |
This instance is less than . |
Zero |
This instance is equal to . |
Greater than zero |
This instance is greater than . |
var length1 = new Length("1in");
var length2 = new Length("2in");
int result = length1.CompareTo(length2); // -1