Class Enumerators
Provides helper methods that expand textual or numeric ranges into strongly typed sequences.
public static class Enumerators
- Inheritance
-
Enumerators
- Inherited Members
Methods
EnumerateCount<T>(T, T, int)
Enumerates a fixed number of values between the start and end bounds.
public static IEnumerable<T> EnumerateCount<T>(T start, T end, int numberOfValues) where T : INumber<T>
Parameters
startTThe first value in the sequence.
endTThe final value to include in the sequence.
numberOfValuesintThe total number of elements that should be generated.
Returns
- IEnumerable<T>
An evenly spaced sequence spanning from
starttoend.
Type Parameters
TThe numeric type produced by the enumeration.
Exceptions
- ArgumentOutOfRangeException
Thrown when
numberOfValuesis less than one.
Enumerate<T>(string)
Parses a textual range description and yields each numeric value described by the range.
public static IEnumerable<T> Enumerate<T>(string ranges) where T : IBinaryInteger<T>
Parameters
rangesstringA string that may contain comma-separated values or dash-separated intervals.
Returns
- IEnumerable<T>
An enumeration of all numeric values referenced by
ranges.
Type Parameters
TThe numeric type produced by the enumeration.
Enumerate<T>(string, CultureInfo)
Parses a textual range description and yields each numeric value described by the range.
public static IEnumerable<T> Enumerate<T>(string ranges, CultureInfo cultureInfo) where T : IBinaryInteger<T>
Parameters
rangesstringA string that may contain comma-separated values or dash-separated intervals.
cultureInfoCultureInfo
Returns
- IEnumerable<T>
An enumeration of all numeric values referenced by
ranges.
Type Parameters
TThe numeric type produced by the enumeration.
Enumerate<T>(string, NumberFormatInfo, params string[])
Parses a textual range description and yields each numeric value described by the range.
public static IEnumerable<T> Enumerate<T>(string ranges, NumberFormatInfo numberFormatInfo, params string[] separators) where T : IBinaryInteger<T>
Parameters
rangesstringA string that may contain comma-separated values or dash-separated intervals.
numberFormatInfoNumberFormatInfoCulture-specific formatting information used when parsing values.
separatorsstring[]Additional separators that delimit entries beyond the culture list separator.
Returns
- IEnumerable<T>
An enumeration of all numeric values referenced by
ranges.
Type Parameters
TThe numeric type produced by the enumeration.
Enumerate<T>(string, TextInfo)
Parses a textual range description and yields each numeric value described by the range.
public static IEnumerable<T> Enumerate<T>(string ranges, TextInfo textInfo) where T : IBinaryInteger<T>
Parameters
rangesstringA string that may contain comma-separated values or dash-separated intervals.
textInfoTextInfo
Returns
- IEnumerable<T>
An enumeration of all numeric values referenced by
ranges.
Type Parameters
TThe numeric type produced by the enumeration.
Enumerate<T>(string, params string[])
Parses a textual range description and yields each numeric value described by the range.
public static IEnumerable<T> Enumerate<T>(string ranges, params string[] separators) where T : IBinaryInteger<T>
Parameters
rangesstringA string that may contain comma-separated values or dash-separated intervals.
separatorsstring[]Additional separators that delimit entries beyond the culture list separator.
Returns
- IEnumerable<T>
An enumeration of all numeric values referenced by
ranges.
Type Parameters
TThe numeric type produced by the enumeration.
Enumerate<T>(T, T)
Enumerates every value between the given bounds using a default step of one unit.
public static IEnumerable<T> Enumerate<T>(T start, T end) where T : INumber<T>
Parameters
startTThe first value in the sequence.
endTThe final value to include in the sequence.
Returns
- IEnumerable<T>
All values starting at
startand ending atend.
Type Parameters
TThe numeric type produced by the enumeration.
Enumerate<T>(T, T, T)
Enumerates every value between the given bounds using the provided step magnitude.
public static IEnumerable<T> Enumerate<T>(T start, T end, T step) where T : INumber<T>
Parameters
startTThe first value in the sequence.
endTThe final value to include in the sequence.
stepTThe difference between two consecutive values.
Returns
- IEnumerable<T>
All values starting at
startand ending atendusingstepincrements.
Type Parameters
TThe numeric type produced by the enumeration.
Exceptions
- ArgumentOutOfRangeException
Thrown when
stepis less than or equal to zero.