Method CompareTo
CompareTo(Object)
Compares this object to another object, returning an instance of System.Relation.
Null is considered less than any instance.
Declaration
public int CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A signed integer value that indicates the relationship of this instance to other,
as shown in the following table. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | If obj is not null and not of type BigRational. |
CompareTo(BigRational)
Compares this instance to a second BigRational and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.
Declaration
public int CompareTo(BigRational b)
Parameters
Type | Name | Description |
---|---|---|
BigRational | b | The object to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A signed integer value that indicates the relationship of this instance to other,
as shown in the following table. |
CompareTo(Int64)
Compares this instance to a second System.Int64 and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.
Declaration
public int CompareTo(long b)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | b | System.Int64 value to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A signed integer value that indicates the relationship of this instance to other,
as shown in the following table. |
Remarks
Fast shortcut for the most common comparisons like: x == 0; x <= 1; x != -1;
etc.