RangeTOverlaps(RangeT) Method |
Returns
true if the given
RangeT is partially contained
within this
RangeT.
Namespace: InnerDrive.CoreAssembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.0.8475.0
Syntax public bool Overlaps(
Range<T> value
)
Parameters
- value RangeT
- The RangeT to compare with this RangeT.
Return Value
Booleantrue 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} A | Range{in} B | A.Overlaps(B)? |
---|
1..10 | -10..-1 | false |
1..10 | -10..1 | * |
1..10 | -5..5 | true |
1..10 | 1..10 | true |
1..10 | 5-15 | true |
1..10 | 10-20 | * |
1..10 | 20-30 | false |
* 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 }.
Orthogonal ranges always overlap, regardless of their IsLowerInclusive and
IsUpperInclusive values.
See Also