Skip to content
ConsoleMonster

API Reference

Class

ConsoleRun

Namespace ConsoleMonster.Live
Assembly ConsoleMonster
Modifiers static

Runs work over many items with a live view of the run (the C# side of ForEach-ConsoleItem).

Inheritance

  • Object
  • ConsoleRun

Methods

public static async Task<IReadOnlyList<RunResult<TItem?, TResult?>>> ForEachAsync<TItem, TResult>(IEnumerable<TItem?> items, Func<TItem?, CancellationToken, Task<TResult?>> body, RunOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Task<IReadOnlyList<RunResult<TItem?, TResult?>>>

Runs body for every item, at most RunOptions.ThrottleLimit at a time, showing the run (summary line, item cells, running items, failures; one line per item when the output is not interactive). An item that throws, or runs past RunOptions.Timeout, counts as failed and the run goes on; cancelling stops starting new items, cancels the running ones and counts the rest as skipped.

Type Parameters

TItem
The item type.
TResult
The result type.

Parameters

items System.Collections.Generic.IEnumerable<TItem?> requiredposition: 0
The items.
body System.Func<TItem?, System.Threading.CancellationToken, System.Threading.Tasks.Task<TResult?>> requiredposition: 1
The work for one item; observe the token for timeouts and cancellation.
options ConsoleMonster.Live.RunOptions? = null optionalposition: 2
Options, or null for the defaults.
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
Stops the run.

Returns

One result per item, in input order (items never started are left out).