C# TimeSpan Equals(Object)
Description
TimeSpan Equals(Object)
returns a value indicating
whether this instance is equal to a specified object.
Syntax
TimeSpan.Equals(Object)
has the following syntax.
public override bool Equals(
Object value
)
Parameters
TimeSpan.Equals(Object)
has the following parameters.
value
- An object to compare with this instance.
Returns
TimeSpan.Equals(Object)
method returns true if value is a TimeSpan object that represents the same time interval
as the current TimeSpan structure; otherwise, false.
Example
The following example demonstrates the Equals method.
/*from www . j av a 2s . c o m*/
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.