CompareTo Method

TimeSpan.CompareTo Method

 

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

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

NameDescription
System_CAPS_pubmethodCompareTo(Object)

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

System_CAPS_pubmethodCompareTo(TimeSpan)

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.

The two overloads of the CompareTo method return a signed number that indicates the relative value of this instance and the value argument, as shown in the following table.

Value

Description

Less than zero

This instance is shorter than value.

Zero

This instance is the same as value.

Greater than zero

This instance is longer than value.

Return to top
Show:
© 2016 Microsoft