IRangeTOverlaps Method

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

Definition

Namespace: InnerDrive.Core
Assembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.2.9017.0
C#
bool Overlaps(
	IRange<T>? value
)

Parameters

value  IRangeT
The range to compare with this range.

Return Value

Boolean
true if the range is partially contained within this range.

Remarks

A range overlaps another range when the any part of one range is contained within the other.
Range ARange BA.Overlaps(B)?
23456012*
23456123true
2345623456true
23456567true
23456678*
23456789false

* 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 = { 3, 4, 5 } and RangeB = { 5, 6, 7 }.

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

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

See Also