Invokes an async selector in parallel.
Syntax
public static Task<IEnumerable<TResult>> ParallelSelectAsync<TSource, TResult>(this IEnumerable<TSource> items, Func<TSource, Task<TResult>> asyncSelector, CancellationToken cancellationToken = default(CancellationToken))
This method will preserve ordering.
Type Parameters
Name |
Description |
TSource |
The type of the elements of items. |
TResult |
The type of the value returned by asyncSelector. |
Parameters
Name |
Type |
Description |
items |
IEnumerable<TSource> |
The items to select from. |
asyncSelector |
Func<TSource, Task<TResult>> |
The selector to apply on each element of items. |
cancellationToken |
CancellationToken |
A cancellation token that can be used to cancel the work. |
Return Value
Type |
Description |
Task<IEnumerable<TResult>> |
The result of invoking the asyncSelector on each element of items. |