System.DateTimeOffset.op_Addition Method

Adds a specified time interval to a DateTimeOffset object that has a specified date and time, and yields a DateTimeOffset object that has new a date and time.

Syntax

public static DateTimeOffset operator+ (DateTimeOffset dateTimeOffset, TimeSpan timeSpan)

Parameters

dateTimeOffset
The object to add the time interval to.
timeSpan
The time interval to add.

Returns

An object whose value is the sum of the values of dateTimeTz and timeSpan.

Remarks

The DateTimeOffset.op_Addition(DateTimeOffset, TimeSpan) method defines the addition operation for DateTimeOffset values. It enables code such as the following:

code reference: System.DateTimeOffset.Operators#1

Languages that do not support custom operators and operator overloading can call the DateTimeOffset.Add(TimeSpan) method instead.

Requirements

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