C# TimeSpan Duration
Description
TimeSpan Duration
returns a new TimeSpan object whose
value is the absolute value of the current TimeSpan object.
Syntax
TimeSpan.Duration
has the following syntax.
public TimeSpan Duration()
Returns
TimeSpan.Duration
method returns A new object whose value is the absolute value of the current TimeSpan object.
Example
The following example applies the Duration method to TimeSpan objects.
// w w w.j av a 2 s . c o m
using System;
class DuraNegaUnaryDemo
{
static void Main()
{
TimeSpan interval = new TimeSpan( -1234567 );
Console.WriteLine( interval.Duration( ));
}
}
The code above generates the following result.