C# TimeSpan Equals(TimeSpan)
Description
TimeSpan Equals(TimeSpan)
returns a value indicating
whether this instance is equal to a specified TimeSpan object.
Syntax
TimeSpan.Equals(TimeSpan)
has the following syntax.
public bool Equals(
TimeSpan obj
)
Parameters
TimeSpan.Equals(TimeSpan)
has the following parameters.
obj
- An object to compare with this instance.
Returns
TimeSpan.Equals(TimeSpan)
method returns true if obj represents the same time interval as this instance; otherwise,
false.
Example
The following example demonstrates the Equals method.
/*from www. j a v a2 s . c om*/
using System;
class Sample
{
public static void Main()
{
TimeSpan tsX = new TimeSpan(11, 22, 33, 44);
TimeSpan l1 = tsX, l2 = tsX;
Console.WriteLine(l1.Equals(l2));
Console.WriteLine(l1.Equals((Object)l2));
}
}
The code above generates the following result.