System.DateTimeOffset.CompareTo Method

Compares the current DateTimeOffset object to a specified DateTimeOffset object and indicates whether the current object is earlier than, the same as, or later than the second DateTimeOffset object.

Syntax

public int CompareTo (DateTimeOffset other)

Parameters

other
An object to compare with the current DateTimeOffset object.

Returns

A signed integer that indicates the relationship between the current DateTimeOffset object and other, as the following table shows.

Less than zero

The current DateTimeOffset object is earlier than other.

Zero

The current DateTimeOffset object is the same as other.

Greater than zero.

The current DateTimeOffset object is later than other.

Remarks

This method compares DateTimeOffset objects by comparing their DateTimeOffset.UtcDateTime values; that is, it determines whether the two objects represent a single point in time, and indicates whether the current object is earlier than, later than, or the same as the other parameter.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0