IRange

Ecng.ComponentModel

Generic range contract exposing strongly-typed bounds.

Implements: IRange, ICloneable

Properties

Length
public T Length { get; }
value = iRange.Length

Gets the difference between the maximum and minimum values of the range.

Max
public T Max { get; }
value = iRange.Max

Gets the maximum value of the range.

Min
public T Min { get; }
value = iRange.Min

Gets the minimum value of the range.

Methods

Contains
public bool Contains(T value)
result = iRange.Contains(value)

Determines whether the specified value is within the current range.

value
The value to test.

Returns: true if the value is within the range; otherwise, false.

Contains
public bool Contains(IRange<T> range)
result = iRange.Contains(range)

Determines whether the current range completely contains another range.

range
The range to check against.

Returns: true if the range is contained; otherwise, false.

Intersect
public IRange<T> Intersect(IRange<T> range)
result = iRange.Intersect(range)

Returns the intersection of the current range with another range.

range
The range with which to intersect.

Returns: A new IRange representing the overlap between the two ranges, or null if there is no intersection.

SubRange
public IRange<T> SubRange(T min, T max)
result = iRange.SubRange(min, max)

Creates a sub-range from the current range given the specified minimum and maximum values.

min
The minimum value of the sub-range.
max
The maximum value of the sub-range.

Returns: A new range representing the sub-range.