Int64.IComparable.CompareTo(Object) 方法

定义

将此实例与指定对象进行比较并返回一个对二者的相对值的指示。Compares this instance to a specified object and returns an indication of their relative values.

 virtual int System.IComparable.CompareTo(System::Object ^ value) = IComparable::CompareTo;
int IComparable.CompareTo (object value);
abstract member System.IComparable.CompareTo : obj -> int
override this.System.IComparable.CompareTo : obj -> int
Function CompareTo (value As Object) As Integer Implements IComparable.CompareTo

参数

value
Object

要比较的对象,或为 nullAn object to compare, or null.

返回

Int32

一个带符号数字,指示此实例和 value 的相对值。A signed number indicating the relative values of this instance and value.

返回值Return Value说明Description
小于零Less than zero此实例小于 valueThis instance is less than value.
Zero此实例等于 valueThis instance is equal to value.
大于零Greater than zero此实例大于 value,或 valuenullThis instance is greater than value, or value is null.

实现

例外

value 不是 Int64value is not an Int64.

注解

此成员是显式接口成员的实现。This member is an explicit interface member implementation. 它只能在 Int64 实例被强制转换为 IConvertible 接口时使用。It can be used only when the Int64 instance is cast to an IConvertible interface.

Int64,无论其值如何,都视为大于空引用。An Int64, regardless of its value, is considered greater than a null reference.

适用于