Table of Contents

ForEachResultAsync Method

Definition

Namespace
Cuemon.Threading
Assemblies
Cuemon.Threading.dll
Source
src/Cuemon.Threading/ParallelFactory.ForEachResultAsync.cs

ForEachResultAsync<TSource, TResult>(IEnumerable<TSource>, Func<TSource, CancellationToken, Task<TResult>>, Action<AsyncWorkloadOptions>)

Executes a parallel foreach loop where the return value of the function delegate worker is stored in the same sequential order as source.

public static Task<IReadOnlyCollection<TResult>> ForEachResultAsync<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, CancellationToken, Task<TResult>> worker, Action<AsyncWorkloadOptions> setup = null)

Parameters

source IEnumerable<TSource>

The sequence to iterate over parallel.

worker Func<TSource, CancellationToken, Task<TResult>>

The delegate that is invoked once per iteration.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task<IReadOnlyCollection<TResult>>

A Task that represents the asynchronous operation. The task result contains an IReadOnlyCollection<T> where the return value of the function delegate worker is stored in the same sequential order as source.

Type Parameters

TSource

The type of the data in the source.

TResult

The type of the return value of the function delegate worker.

ForEachResultAsync<TSource, T, TResult>(IEnumerable<TSource>, Func<TSource, T, CancellationToken, Task<TResult>>, T, Action<AsyncWorkloadOptions>)

Executes a parallel foreach loop where the return value of the function delegate worker is stored in the same sequential order as source.

public static Task<IReadOnlyCollection<TResult>> ForEachResultAsync<TSource, T, TResult>(IEnumerable<TSource> source, Func<TSource, T, CancellationToken, Task<TResult>> worker, T arg, Action<AsyncWorkloadOptions> setup = null)

Parameters

source IEnumerable<TSource>

The sequence to iterate over parallel.

worker Func<TSource, T, CancellationToken, Task<TResult>>

The delegate that is invoked once per iteration.

arg T

The parameter of the function delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task<IReadOnlyCollection<TResult>>

A Task that represents the asynchronous operation. The task result contains an IReadOnlyCollection<T> where the return value of the function delegate worker is stored in the same sequential order as source.

Type Parameters

TSource

The type of the data in the source.

T

The type of the parameter of the function delegate worker.

TResult

The type of the return value of the function delegate worker.

ForEachResultAsync<TSource, T1, T2, TResult>(IEnumerable<TSource>, Func<TSource, T1, T2, CancellationToken, Task<TResult>>, T1, T2, Action<AsyncWorkloadOptions>)

Executes a parallel foreach loop where the return value of the function delegate worker is stored in the same sequential order as source.

public static Task<IReadOnlyCollection<TResult>> ForEachResultAsync<TSource, T1, T2, TResult>(IEnumerable<TSource> source, Func<TSource, T1, T2, CancellationToken, Task<TResult>> worker, T1 arg1, T2 arg2, Action<AsyncWorkloadOptions> setup = null)

Parameters

source IEnumerable<TSource>

The sequence to iterate over parallel.

worker Func<TSource, T1, T2, CancellationToken, Task<TResult>>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the function delegate worker.

arg2 T2

The second parameter of the function delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task<IReadOnlyCollection<TResult>>

A Task that represents the asynchronous operation. The task result contains an IReadOnlyCollection<T> where the return value of the function delegate worker is stored in the same sequential order as source.

Type Parameters

TSource

The type of the data in the source.

T1

The type of the first parameter of the function delegate worker.

T2

The type of the second parameter of the function delegate worker.

TResult

The type of the return value of the function delegate worker.

ForEachResultAsync<TSource, T1, T2, T3, TResult>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, CancellationToken, Task<TResult>>, T1, T2, T3, Action<AsyncWorkloadOptions>)

Executes a parallel foreach loop where the return value of the function delegate worker is stored in the same sequential order as source.

public static Task<IReadOnlyCollection<TResult>> ForEachResultAsync<TSource, T1, T2, T3, TResult>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, CancellationToken, Task<TResult>> worker, T1 arg1, T2 arg2, T3 arg3, Action<AsyncWorkloadOptions> setup = null)

Parameters

source IEnumerable<TSource>

The sequence to iterate over parallel.

worker Func<TSource, T1, T2, T3, CancellationToken, Task<TResult>>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the function delegate worker.

arg2 T2

The second parameter of the function delegate worker.

arg3 T3

The third parameter of the function delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task<IReadOnlyCollection<TResult>>

A Task that represents the asynchronous operation. The task result contains an IReadOnlyCollection<T> where the return value of the function delegate worker is stored in the same sequential order as source.

Type Parameters

TSource

The type of the data in the source.

T1

The type of the first parameter of the function delegate worker.

T2

The type of the second parameter of the function delegate worker.

T3

The type of the third parameter of the function delegate worker.

TResult

The type of the return value of the function delegate worker.

ForEachResultAsync<TSource, T1, T2, T3, T4, TResult>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, CancellationToken, Task<TResult>>, T1, T2, T3, T4, Action<AsyncWorkloadOptions>)

Executes a parallel foreach loop where the return value of the function delegate worker is stored in the same sequential order as source.

public static Task<IReadOnlyCollection<TResult>> ForEachResultAsync<TSource, T1, T2, T3, T4, TResult>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, CancellationToken, Task<TResult>> worker, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Action<AsyncWorkloadOptions> setup = null)

Parameters

source IEnumerable<TSource>

The sequence to iterate over parallel.

worker Func<TSource, T1, T2, T3, T4, CancellationToken, Task<TResult>>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the function delegate worker.

arg2 T2

The second parameter of the function delegate worker.

arg3 T3

The third parameter of the function delegate worker.

arg4 T4

The fourth parameter of the function delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task<IReadOnlyCollection<TResult>>

A Task that represents the asynchronous operation. The task result contains an IReadOnlyCollection<T> where the return value of the function delegate worker is stored in the same sequential order as source.

Type Parameters

TSource

The type of the data in the source.

T1

The type of the first parameter of the function delegate worker.

T2

The type of the second parameter of the function delegate worker.

T3

The type of the third parameter of the function delegate worker.

T4

The type of the fourth parameter of the function delegate worker.

TResult

The type of the return value of the function delegate worker.

ForEachResultAsync<TSource, T1, T2, T3, T4, T5, TResult>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, T5, CancellationToken, Task<TResult>>, T1, T2, T3, T4, T5, Action<AsyncWorkloadOptions>)

Executes a parallel foreach loop

public static Task<IReadOnlyCollection<TResult>> ForEachResultAsync<TSource, T1, T2, T3, T4, T5, TResult>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, T5, CancellationToken, Task<TResult>> worker, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Action<AsyncWorkloadOptions> setup = null)

Parameters

source IEnumerable<TSource>

The sequence to iterate over parallel.

worker Func<TSource, T1, T2, T3, T4, T5, CancellationToken, Task<TResult>>

The delegate that is invoked once per iteration.

arg1 T1

The first parameter of the function delegate worker.

arg2 T2

The second parameter of the function delegate worker.

arg3 T3

The third parameter of the function delegate worker.

arg4 T4

The fourth parameter of the function delegate worker.

arg5 T5

The fifth parameter of the function delegate worker.

setup Action<AsyncWorkloadOptions>

The AsyncWorkloadOptions which may be configured.

Returns

Task<IReadOnlyCollection<TResult>>

A Task that represents the asynchronous operation. The task result contains an IReadOnlyCollection<T> where the return value of the function delegate worker is stored in the same sequential order as source.

Type Parameters

TSource

The type of the data in the source.

T1

The type of the first parameter of the function delegate worker.

T2

The type of the second parameter of the function delegate worker.

T3

The type of the third parameter of the function delegate worker.

T4

The type of the fourth parameter of the function delegate worker.

T5

The type of the fifth parameter of the function delegate worker.

TResult

The type of the return value of the function delegate worker.