RangeHelper

Ecng.ComponentModel

Provides helper methods for manipulating Range objects.

メソッド

Exclude
public static IEnumerable<IRange<DateTimeOffset>> Exclude(IRange<DateTimeOffset> from, Range<DateTimeOffset> excludingRange)
result = RangeHelper.Exclude(from, excludingRange)

Excludes the specified DateTimeOffset range from the current range.

from
The original DateTimeOffset range.
excludingRange
The DateTimeOffset range to exclude.

戻り値: A collection of remaining DateTimeOffset ranges after exclusion.

Exclude
public static IEnumerable<Range<DateTime>> Exclude(Range<DateTime> from, Range<DateTime> excludingRange)
result = RangeHelper.Exclude(from, excludingRange)

Excludes the specified DateTime range from the current range.

from
The original DateTime range.
excludingRange
The DateTime range to exclude.

戻り値: A collection of remaining DateTime ranges after exclusion.

Exclude
public static IEnumerable<IRange<long>> Exclude(IRange<long> from, IRange<long> excludingRange)
result = RangeHelper.Exclude(from, excludingRange)

Excludes the specified long range from the current long range.

from
The original long range.
excludingRange
The long range to exclude.

戻り値: A collection of remaining long ranges after exclusion.

GetRanges
public static IEnumerable<IRange<DateTimeOffset>> GetRanges(IEnumerable<DateTimeOffset> dates, DateTimeOffset from, DateTimeOffset to)
result = RangeHelper.GetRanges(dates, from, to)

Generates ranges from a sequence of DateTimeOffset values within the specified boundaries.

dates
The sequence of DateTimeOffset values.
from
The start boundary.
to
The end boundary.

戻り値: A collection of DateTimeOffset ranges.

GetRanges
public static IEnumerable<Range<DateTime>> GetRanges(IEnumerable<DateTime> dates, DateTime from, DateTime to)
result = RangeHelper.GetRanges(dates, from, to)

Generates ranges from a sequence of DateTime values within the specified boundaries.

dates
The sequence of DateTime values.
from
The start boundary.
to
The end boundary.

戻り値: A collection of DateTime ranges.

GetRanges
public static IEnumerable<Range<long>> GetRanges(IEnumerable<long> dates, long from, long to)
result = RangeHelper.GetRanges(dates, from, to)

Generates ranges based on a sequence of long values (ticks) given the specified start and end boundaries.

dates
The sequence of long values representing tick counts.
from
The starting tick value.
to
The ending tick value.

戻り値: A collection of ranges represented by long values.

IsEmpty
public static bool IsEmpty(IRange range)
result = RangeHelper.IsEmpty(range)

Determines whether the specified range is empty, meaning it has no defined minimum or maximum value.

range
The range to check.

戻り値: true if the range has no minimum and maximum value; otherwise, false.

JoinRanges``1
public static IEnumerable<IRange<T>> JoinRanges<T>(IEnumerable<IRange<T>> ranges)
result = RangeHelper.JoinRanges(ranges)

Joins overlapping or contiguous ranges in the collection.

ranges
The collection of ranges to join.

戻り値: A collection of combined ranges.

ToRange``1
public static Range<T> ToRange<T>(SettingsStorage storage)
result = RangeHelper.ToRange(storage)

Constructs a Range<T> object from the provided SettingsStorage.

storage
The SettingsStorage containing the range data.

戻り値: A new Range<T> initialized with the storage values.

ToStorage``1
public static SettingsStorage ToStorage<T>(IRange<T> range)
result = RangeHelper.ToStorage(range)

Converts the range to a SettingsStorage object for serialization.

range
The range to convert.

戻り値: A SettingsStorage object containing the range data.