ParallelSelectManyAsync<TSource, TResult>(IEnumerable<TSource>, Func<TSource, Task<IEnumerable<TResult>>>, CancellationToken) Method
Invokes an async selector that returns multiple results in parallel.
Namespace
Statiq.Common
Containing Type
ParallelAsyncExtensions

Syntax

public static Task<IEnumerable<TResult>> ParallelSelectManyAsync<TSource, TResult>(this IEnumerable<TSource> items, Func<TSource, Task<IEnumerable<TResult>>> asyncSelector, CancellationToken cancellationToken = default(CancellationToken))

Remarks

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<IEnumerable<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.