C# TimeSpan LessThan
Description
TimeSpan LessThan
indicates whether a specified TimeSpan
is less than another specified TimeSpan.
Syntax
TimeSpan.LessThan
has the following syntax.
public static bool operator <(
TimeSpan t1,
TimeSpan t2
)
Parameters
TimeSpan.LessThan
has the following parameters.
t1
- The first time interval to compare.t2
- The second time interval to compare.
Returns
TimeSpan.LessThan
method returns true if the value of t1 is less than the value of t2; otherwise, false.
Example
The following example compares several TimeSpan objects to a reference TimeSpan using the LessThan operator.
using System;/*from www. j av a 2 s . 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.