Date |
public int CompareTo( DateTimeOffset other )
Value | meaning |
---|---|
Less than zero |
Both the Lower and Upper
members of this DateRange are less than other - or - Both the Lower and Upper members of this DateRange are less than or equal to other and IsUpperInclusive is false |
Zero | This instance is equal to or contains other |
Greater than zero |
Both the Lower and Upper
members of this DateRange are greater than other - or - Both the Lower and Upper members of this DateRange are greater than or equal to other and IsLowerInclusive is false |
DateTimeOffset early = DateTimeOffset.Now.AddHours(-1); DateTimeOffset late = DateTimeOffset.Now.AddHours(1); DateRange earlyToLate = new DateRange(early, late); earlyToLate.CompareTo(DateTimeOffset.Now); --> 0 earlyToLate.CompareTo(early); --> 0 earlyToLate.CompareTo(early.AddHours(-1)); --> -1 earlyToLate.CompareTo(late); --> 0 earlyToLate.CompareTo(late.AddHours(1)); --> 1