Click or drag to resize

RangeTOverlaps(RangeT) Method

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

Namespace: InnerDrive.Core
Assembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.0.8475.0
Syntax
C#
public bool Overlaps(
	Range<T> value
)

Parameters

value  RangeT
The RangeT to compare with this RangeT.

Return Value

Boolean
true if any part of the RangeT is contained within this RangeT, or vice-versa.
Remarks
A RangeT overlaps another RangeT when the any part of one RangeT is contained within the other.
Range{int} ARange{in} BA.Overlaps(B)?
1..10-10..-1false
1..10-10..1*
1..10-5..5true
1..101..10true
1..105-15true
1..1010-20*
1..1020-30false

* 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 - 18 } and RangeB = { 18 - 20 }.

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

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

See Also