Click or drag to resize

MoreEnumerableSequence Method (Int32, Int32, Int32)

Generates a sequence of integral numbers within the (inclusive) specified range. An additional parameter specifies the steps in which the integers of the sequence increase or decrease.

Namespace:  MoreLinq
Assembly:  MoreLinq (in MoreLinq.dll) Version: 2.4.0
public static IEnumerable<int> Sequence(
	int start,
	int stop,
	int step


Type: SystemInt32
The value of the first integer in the sequence.
Type: SystemInt32
The value of the last integer in the sequence.
Type: SystemInt32
The step to define the next number.

Return Value

Type: IEnumerableInt32
An IEnumerableT that contains a range of sequential integral numbers.
When step is equal to zero, this operator returns an infinite sequence where all elements are equals to start. This operator uses deferred execution and streams its results.
var result = MoreEnumerable.Sequence(6, 0, -2);
The result variable will contain { 6, 4, 2, 0 }.
See Also