C# TimeSpan Equality
Description
TimeSpan Equality
indicates whether two TimeSpan instances
are equal.
Syntax
TimeSpan.Equality
has the following syntax.
public static bool operator ==(
TimeSpan t1,
TimeSpan t2
)
Parameters
TimeSpan.Equality
has the following parameters.
t1
- The first time interval to compare.t2
- The second time interval to compare.
Returns
TimeSpan.Equality
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 using the Equality operator.
using System;//from ww w .ja va 2s. co m
class MainClass
{
static void Main( )
{
TimeSpan Left = new TimeSpan( 2, 0, 0 );
Console.WriteLine( Left == new TimeSpan( 0, 120, 0 ));
}
}
The code above generates the following result.