Show / Hide Table of Contents

Class EnumerableExtensions

Extension methods on IEnumerable<T>.

Inheritance
object
EnumerableExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DNVGL.One.Compute.Core.Extensions
Assembly: DNVGL.One.Compute.Core.dll
Syntax
public static class EnumerableExtensions

Methods

View Source

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

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.

int degreeOfParallelism

The degree of parallelism. Default is 10.

Returns
Type Description
Task

Asynchronous Task.

Type Parameters
Name Description
T

Element type.

Remarks

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

  • View Source
In this article
Back to top Copyright © DNV AS. All rights reserved.