System.DateTimeOffset.op_Equality Method

Determines whether two specified DateTimeOffset objects represent the same point in time.

Syntax

public static bool operator== (DateTimeOffset left, DateTimeOffset right)

Parameters

left
The first object to compare.
right
The second object to compare.

Returns

true if both DateTimeOffset objects have the same DateTimeOffset.UtcDateTime value; otherwise, false.

Remarks

The DateTimeOffset.op_Equality(DateTimeOffset, DateTimeOffset) method defines the operation of the equality operator for DateTimeOffset objects. It enables code such as the following:

code reference: System.DateTimeOffset.Operators#2

Before evaluating the left and right operands for equality, the operator converts both values to Coordinated Universal Time (UTC). The operation is equivalent to the following:

code reference: System.DateTimeOffset.Syntax#4

In other words, the DateTimeOffset.op_Equality(DateTimeOffset, DateTimeOffset) method determines whether the two DateTimeOffset objects represent a single point in time. It directly compares neither dates and times nor offsets. To determine whether two DateTimeOffset objects represent the same time and have the same offset value, use the DateTimeOffset.EqualsExact(DateTimeOffset) method.

Requirements

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