Partager via


TimeSpan.CompareTo Method

Compares a specified TimeSpan object (time period) or other time-period object with the current TimeSpan object to determine their relative value.

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

Syntax

public int CompareTo (
         Object value
)

Parameters

  • value
    A TimeSpan object or a null reference.

Return Value

An integer that represents the value of the specified TimeSpan object or other time-period object relative to the current TimeSpan object.

Return value Meaning
Less than 0 (zero) The current TimeSpan object is less than the object specified by the value parameter.
0 (zero) The current TimeSpan object is equal to the object specified by the value parameter.
Greater than 0 (zero) The current TimeSpan object is greater than the object specified by the value parameter.

Remarks

Any TimeSpan object, regardless of its value, is considered greater than a null reference.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

TimeSpan Structure
TimeSpan Members
System Namespace