Method BindByIndex
BindByIndex<TSource>(IAsyncEnumerable<TSource>, IAsyncEnumerable<int>)
Selects elements by index from a sequence.
Declaration
public static IAsyncEnumerable<TSource> BindByIndex<TSource>(this IAsyncEnumerable<TSource> source, IAsyncEnumerable<int> indices)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The source sequence. |
| IAsyncEnumerable<int> | indices | The list of indices of elements in the |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TSource> | An IAsyncEnumerable<T> whose elements are the result of selecting elements according to the |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentOutOfRangeException | An index in |
BindByIndex<TSource, TResult>(IAsyncEnumerable<TSource>, IAsyncEnumerable<int>, Func<TSource, int, TResult>, Func<int, TResult>)
Selects elements by index from a sequence and transforms them using the provided functions.
Declaration
public static IAsyncEnumerable<TResult> BindByIndex<TSource, TResult>(this IAsyncEnumerable<TSource> source, IAsyncEnumerable<int> indices, Func<TSource, int, TResult> resultSelector, Func<int, TResult> missingSelector)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The source sequence. |
| IAsyncEnumerable<int> | indices | The list of indices of elements in the |
| Func<TSource, int, TResult> | resultSelector | A transform function to apply to each source element; the second parameter of the function represents the index of the output sequence. |
| Func<int, TResult> | missingSelector | A transform function to apply to missing source elements; the parameter represents the index of the output sequence. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TResult> | An IAsyncEnumerable<T> whose elements are the result of selecting elements according to the |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of |
| TResult | The type of the elements of the resulting sequence. |
Remarks
This method uses deferred execution and streams its results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentNullException |
|