DateTimeOffset.IComparable.CompareTo(Object) 方法

定义

将当前 DateTimeOffset 对象的值与相同类型的另一个对象的值进行比较。Compares the value of the current DateTimeOffset object with another object of the same type.

 virtual int System.IComparable.CompareTo(System::Object ^ obj) = IComparable::CompareTo;
int IComparable.CompareTo (object obj);
Function CompareTo (obj As Object) As Integer Implements IComparable.CompareTo

参数

obj
Object

要与当前 DateTimeOffset 对象进行比较的对象。The object to compare with the current DateTimeOffset object.

返回

一个 32 位带符号整数,它指示当前的 DateTimeOffset 对象是小于、等于还是大于 objA 32-bit signed integer that indicates whether the current DateTimeOffset object is less than, equal to, or greater than obj. 此方法的返回值的说明如下:The return values of the method are interpreted as follows:

返回值Return Value 说明Description
小于零Less than zero 当前的 DateTimeOffset 对象小于(早于)objThe current DateTimeOffset object is less than (earlier than) obj.
Zero 当前的 DateTimeOffset 对象与 obj 相等(表示同一时间点)。The current DateTimeOffset object is equal to (the same point in time as) obj.
大于零Greater than zero 当前的 DateTimeOffset 对象大于(晚于)objThe current DateTimeOffset object is greater than (later than) obj.

实现

适用于