Method Sequence
Sequence(int, int)
Generates a sequence of integral numbers within the (inclusive) specified range. If sequence is ascending the step is +1, otherwise -1.
Declaration
public static IAsyncEnumerable<int> Sequence(int start, int stop)
Parameters
| Type | Name | Description |
|---|---|---|
| int | start | The value of the first integer in the sequence. |
| int | stop | The value of the last integer in the sequence. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<int> | An IEnumerable<T> that contains a range of sequential integral numbers. |
Remarks
This operator uses deferred execution and streams its results.
Examples
var result = AsyncSuperEnumerable.Sequence(6, 0);
The result variable will contain { 6, 5, 4, 3, 2, 1, 0 }.
Sequence(int, int, int)
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.
Declaration
public static IAsyncEnumerable<int> Sequence(int start, int stop, int step)
Parameters
| Type | Name | Description |
|---|---|---|
| int | start | The value of the first integer in the sequence. |
| int | stop | The value of the last integer in the sequence. |
| int | step | The step to define the next number. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<int> | An IEnumerable<T> that contains a range of sequential integral numbers. |
Remarks
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.
Examples
var result = AsyncSuperEnumerable.Sequence(6, 0, -2);
The result variable will contain { 6, 4, 2, 0 }.