Mono Class Library: System.TimeSpan Overview | Members

System.TimeSpan.Add Method

Adds the specified TimeSpan to the current instance.

public TimeSpan Add (TimeSpan ts)

Parameters

ts
A TimeSpan instance to add to the current instance.

Returns

A TimeSpan that represents the value of the current instance plus the value of ts.

Exceptions

TypeReason
OverflowExceptionThe sum of the value of the current instance and the value of ts is less than TimeSpan.MinValue or greater than TimeSpan.MaxValue.

Remarks

Documentation for this section has not yet been entered.

Example

This example demonstrates the TimeSpan.Add(TimeSpan) method.

C# Example

using System;
public class TimeSpanAddExample {
   public static void Main() {
      TimeSpan ts = new TimeSpan(Int32.MaxValue);
      Console.WriteLine("The value of the timespan 'ts' is {0}", ts);
      Console.WriteLine("ts.Add(ts) = {0}", ts.Add(ts));
   }
}

The output is

The value of the timespan 'ts' is 00:03:34.7483647
ts.Add(ts) = 00:07:09.4967294

Requirements

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