Show / Hide Table of Contents

Class EnumerableExtensions

Extension methods on

Inheritance
System.Object
EnumerableExtensions
Namespace: DNVGL.One.Compute.Core.Extensions
Assembly: DNVGL.One.Compute.Core.dll
Syntax
public static class EnumerableExtensions : object

Methods

View Source

ForEachAsync<T>(IEnumerable<T>, Func<T, Task>, Int32)

Execute the given action on every element in the source collection in parallel, with a given degree of parallelism (max. number of parallel tasks).

Declaration
public static Task ForEachAsync<T>(this IEnumerable<T> source, Func<T, Task> action, int degreeOfParallelism = 10)
Parameters
Type Name Description
IEnumerable<T> source

The source collection.

Func<T, Task> action

The action to execute on each element in the source collection.

System.Int32 degreeOfParallelism

The degree of parallelism. Default is 10.

Returns
Type Description
Task

Async task

Type Parameters
Name Description
T

Element type

Remarks

See https://blogs.msdn.microsoft.com/pfxteam/2012/03/05/implementing-a-simple-foreachasync-part-2/

  • View Source
Back to top Copyright © DNV GL AS. All rights reserved.