System.TimeSpan.CompareTo Method

Compares this instance to a specified TimeSpan object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the TimeSpan object.

Syntax

public int CompareTo (TimeSpan value)

Parameters

value
An object to compare to this instance.

Returns

A signed number indicating the relative values of this instance and value.

A negative integer

This instance is shorter than value.

Zero

This instance is equal to value.

A positive integer

This instance is longer than value.

Remarks

This method implements the IComparable`1 interface and performs slightly better than the TimeSpan.CompareTo(object) method because it does not have to convert the value parameter to an object.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0