DateRangeOverlaps(DateRange) Method

Returns true if the given DateRange is partially contained within this DateRange.

Definition

Namespace: InnerDrive.Core
Assembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.2.9017.0
C#
public bool Overlaps(
	DateRange value
)

Parameters

value  DateRange
The DateRange to compare with this DateRange.

Return Value

Boolean
true if any part of the DateRange is contained within this DateRange, or vice-versa.

Remarks

A DateRange overlaps another DateRange when the any part of one DateRange is contained within the other.
DateRange ADateRange BA.Overlaps(B)?
Jan 1-Jan 31Dec 1-Dec 31false
Jan 1-Jan 31Dec 1-Jan 1*
Jan 1-Jan 31Dec 15-Jan 15true
Jan 1-Jan 31Jan 1-Jan 31true
Jan 1-Jan 31Jan 15-Feb 15true
Jan 1-Jan 31Jan 31-Feb 28*
Jan 1-Jan 31Feb 1-Feb 28false

* The behavior of Overlaps depends on whether the ranges are inclusive. Also, the results of RangeA.Overlaps(RangeB) and RangeB.Overlaps(RangeA) must always return the same value. Therefore, the following shows the behavior of two adjacent ranges. Assume RangeA = { 16:00 - 18:00 } and RangeB = { 18:00 - 20:00 }.

RangeA.IsUpperInclusiveRangeB.IsLowerInclusiveA.Overlaps(B)?
truetruetrue
truefalsefalse
falsetruefalse
falsefalsefalse

Orthogonal ranges always overlap, regardless of their IsLowerInclusive and IsUpperInclusive values.

See Also