System.DateTimeOffset.Equals Method

Determines whether the current DateTimeOffset object represents the same point in time as a specified DateTimeOffset object.

Syntax

public bool Equals (DateTimeOffset other)

Parameters

other
An object to compare to the current DateTimeOffset object.

Returns

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

Remarks

Before it performs the comparison, this method converts the values of both DateTimeOffset objects to Coordinated Universal Time (UTC). The method is equivalent to the following:

code reference: System.DateTimeOffset.Syntax#2

In other words, the DateTimeOffset.Equals(DateTimeOffset) method determines whether 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.

A DateTimeOffset object that is not null is considered to be later (or greater) than one that is null.

This overload of the DateTimeOffset.Equals(DateTimeOffset) method implements the IEquatable`1.Equals(`0) method. It offers slightly better performance than the DateTimeOffset.Equals(object) overload because the other parameter does not have to be converted from an object.

Requirements

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