Table of Contents

ForEach Method

ForEach<TSource, TResult>(int, IEnumerable<TSource>, Func<TSource, Task<TResult>>)

public static Fibers<TSource, TResult> ForEach<TSource, TResult>(int concurrency, IEnumerable<TSource> items, Func<TSource, Task<TResult>> factory)

Creates a new Fibers<TSource, TValue> instance for processing a collection of items.

Parameters

concurrency int

The maximum number of concurrent tasks.

items IEnumerable<TSource>

The collection of items to process.

factory Func<TSource, Task<TResult>>

A function that takes an item of type TSource and returns a Task<TResult>.

Returns

Fibers<TSource, TResult>

A new Fibers<TSource, TValue> instance.

Type Parameters

TSource

The type of the source items.

TResult

The type of the result produced by the factory function.