Click or drag to resize

RangeTCompareTo(T) Method

Compares this instance to a specified DateTimeOffset structure and returns an indication of their relative values.

Namespace: InnerDrive.Core
Assembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.0.8475.0
Syntax
C#
public int CompareTo(
	T other
)

Parameters

other  T
A value structure to compare, or a null reference.

Return Value

Int32
A signed number indicating the relative values of this instance and other. The return value has these meanings:
Valuemeaning
Less than zero Both the Lower and Upper members of this value are less than other
- or -
Both the Lower and Upper members of this value are less than or equal to other and IsUpperInclusive is false
ZeroThis instance is equal to or contains other
Greater than zero Both the Lower and Upper members of this value are greater than other
- or -
Both the Lower and Upper members of this value are greater than or equal to other and IsLowerInclusive is false
Example
The following illustrates how a DateRange compares to various DateTimeOffset objects:
C#
var low = -1;
var high = 1);
var earlyToLate = new Range<int>(low, high);

earlyToLate.CompareTo(0);
--> 0

earlyToLate.CompareTo(low);
--> 0

earlyToLate.CompareTo(low - 1);
--> -1

earlyToLate.CompareTo(high);
--> 0

earlyToLate.CompareTo(late + 1);
--> 1
See Also