Skip to main content
Corvus Connection

For Each (Parallel)

Concurrency
Control
flow.forEachParallelRuns the body for every element of a collection in parallel, capped at 'maxDegreeOfParallelism' concurrent items (0 = unbounded). Failure-safe: one item's error is logged and the rest continue.Bounded parallel-foreach over a collection, failure-safe.

Inputs

Name
Kind
Type
Flags
in
Exec
exec
multiplexed
source
Data
any
None
  • Name
    in
    Kind
    Exec
    Type
    exec
    Flags
    multiplexed
  • Name
    source
    Kind
    Data
    Type
    any
    Flags
    None

Outputs

Name
Kind
Type
Flags
body
Exec
exec
None
item
Data
any
multiplexed
completed
Exec
exec
None
  • Name
    body
    Kind
    Exec
    Type
    exec
    Flags
    None
  • Name
    item
    Kind
    Data
    Type
    any
    Flags
    multiplexed
  • Name
    completed
    Kind
    Exec
    Type
    exec
    Flags
    None

Parameters

Name
Type
Required
Default
Choices
maxDegreeOfParallelism
System.Int32
no
4
None
  • Name
    maxDegreeOfParallelism
    Type
    System.Int32
    Required
    no
    Default
    4
    Choices
    None

Lowers to C#

await Parallel.ForEachAsync(source, new() { MaxDegreeOfParallelism = n }, async (item, ct) => { /* body */ });

Used in