C# TimeSpan Equals(TimeSpan, TimeSpan)
Description
TimeSpan Equals(TimeSpan, TimeSpan)
returns a value
that indicates whether two specified instances of TimeSpan are equal.
Syntax
TimeSpan.Equals(TimeSpan, TimeSpan)
has the following syntax.
public static bool Equals(
TimeSpan t1,
TimeSpan t2
)
Parameters
TimeSpan.Equals(TimeSpan, TimeSpan)
has the following parameters.
t1
- The first time interval to compare.t2
- The second time interval to compare.
Returns
TimeSpan.Equals(TimeSpan, TimeSpan)
method returns true if the values of t1 and t2 are equal; otherwise, false.
Example
The following example compares several TimeSpan objects to a reference TimeSpan object using the static Equals method.
using System;//w w w.j a v a 2 s . co m
class TSCompareEqualsDemo
{
static void Main( )
{
TimeSpan Left = new TimeSpan( 2, 0, 0 );
Console.WriteLine(TimeSpan.Equals( Left, new TimeSpan( 0, 120, 0 ) ) );
}
}
The code above generates the following result.