Method ZipMap
ZipMap<TSource, TResult>(IAsyncEnumerable<TSource>, Func<TSource, TResult>)
Applies a function to each element in a sequence and returns a sequence of tuples containing both the original item as well as the function result.
Declaration
public static IAsyncEnumerable<(TSource item, TResult result)> ZipMap<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, TResult> selector)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | A sequence of values to invoke a transform function on |
| Func<TSource, TResult> | selector | A transform function to apply to each source element |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<(TSource item, TResult result)> | An IAsyncEnumerable<T> whose elements are a tuple of the original element and
the item returned from calling the |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of source |
| TResult | The type of the value returned by selector |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
ZipMap<TSource, TResult>(IAsyncEnumerable<TSource>, Func<TSource, ValueTask<TResult>>)
Applies a function to each element in a sequence and returns a sequence of tuples containing both the original item as well as the function result.
Declaration
public static IAsyncEnumerable<(TSource item, TResult result)> ZipMap<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TResult>> selector)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | A sequence of values to invoke a transform function on |
| Func<TSource, ValueTask<TResult>> | selector | A transform function to apply to each source element |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<(TSource item, TResult result)> | An IAsyncEnumerable<T> whose elements are a tuple of the original element and
the item returned from calling the |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of source |
| TResult | The type of the value returned by selector |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
ZipMap<TSource, TResult>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken, ValueTask<TResult>>)
Applies a function to each element in a sequence and returns a sequence of tuples containing both the original item as well as the function result.
Declaration
public static IAsyncEnumerable<(TSource item, TResult result)> ZipMap<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TResult>> selector)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | A sequence of values to invoke a transform function on |
| Func<TSource, CancellationToken, ValueTask<TResult>> | selector | A transform function to apply to each source element |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<(TSource item, TResult result)> | An IAsyncEnumerable<T> whose elements are a tuple of the original element and
the item returned from calling the |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of source |
| TResult | The type of the value returned by selector |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|