System.TimeSpan.op_Addition Method

Adds two specified TimeSpan instances.

Syntax

public static TimeSpan operator+ (TimeSpan t1, TimeSpan t2)

Parameters

t1
The first time interval to add.
t2
The second time interval to add.

Returns

An object whose value is the sum of the values of t1 and t2.

Exceptions

TypeReason
OverflowExceptionThe sum of t1 and t2 is less than TimeSpan.MinValue or greater than TimeSpan.MaxValue.

Remarks

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

code reference: System.TimeSpan.Operators#1

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

Requirements

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