C# TimeSpan Negate
Description
TimeSpan Negate
returns a new TimeSpan object whose value
is the negated value of this instance.
Syntax
TimeSpan.Negate
has the following syntax.
public TimeSpan Negate()
Returns
TimeSpan.Negate
method returns A new object with the same numeric value as this instance, but with the opposite
sign.
Example
The following example applies the Negate method to TimeSpan object.
/*w w w . ja va 2 s. co m*/
using System;
class DuraNegaUnaryDemo
{
static void Main()
{
TimeSpan ts = new TimeSpan( 1 );
Console.WriteLine( ts.Negate( ) );
}
}
The code above generates the following result.