CakeTaskBuilderOfTExtensions.

DoesForEach<TData, TItem>(CakeTaskBuilder<TData>, IAsyncEnumerable<TItem>, Func<TData, TItem, ICakeContext, Task>) Method

Summary

Adds an asynchronous action to be executed foreach item in the asynchronous list. This method will be executed the first time the task is executed.
Namespace
Cake.Core
Containing Type
CakeTaskBuilderOfTExtensions

Syntax

public static CakeTaskBuilder<TData> DoesForEach<TData, TItem>(this CakeTaskBuilder<TData> builder, IAsyncEnumerable<TItem> items, Func<TData, TItem, ICakeContext, Task> action) 
    where TData : class

Examples

TaskOf<Foo>("Pack")
    .DoesForEach(GetFrameworksAsync(), async (data, tfm, context) =>
{
    await System.Threading.Tasks.Task.Delay(10);
    context.Log.Information("Packing {0} for {1}", tfm, data.Place);
});

Type Parameters

Name Description
TData The type of the data context.
TItem The item type.

Parameters

Name Type Description
builder CakeTaskBuilder<TData> The task builder.
items IAsyncEnumerable<TItem> The items.
action Func<TData, TItem, ICakeContext, Task> The action.

Return Value

Type Description
CakeTaskBuilder<TData> The same CakeTaskBuilder<TData> instance so that multiple calls can be chained.