C# Int64 CompareTo(Object)
Description
Int64 CompareTo(Object)
compares this instance to a
specified object and returns an indication of their relative values.
Syntax
Int64.CompareTo(Object)
has the following syntax.
public int CompareTo(
Object value
)
Parameters
Int64.CompareTo(Object)
has the following parameters.
value
- An object to compare, or null.
Returns
Int64.CompareTo(Object)
method returns A signed number indicating the relative values of this instance and value.
Return Value Description Less than zero This instance is less than value.
Zero This instance is equal to value. Greater than zero This instance is greater
than value. -or- value is null.
Example
The following code example demonstrates the CompareTo method.
using System;//w w w. j av a 2 s .c o m
class Sample
{
public static void Main()
{
Int64 e1 = 4, e2 = -4;
Console.WriteLine(e1.CompareTo((Object)e2));
}
}
The code above generates the following result.