A new object whose value is the absolute value of the current TimeSpan object.
Type Reason OverflowException The value of the current instance is TimeSpan.MinValue.
The following example demonstrates the TimeSpan.Duration method.
C# Example
using System; public class TimeSpanDurationExample { public static void Main() { TimeSpan ts = new TimeSpan(Int32.MinValue); Console.Write("The absolute value of TimeSpan {0} ", ts); Console.WriteLine("is {0}", ts.Duration()); } }
The output is
The absolute value of TimeSpan -00:03:34.7483648 is 00:03:34.7483648