Class ForEachTask
Provides a static factory method for ForEachTask<T> as an alternative to calling the constructor to exploit type inference.
Namespace: NanoByte.Common.Tasks
Assembly: NanoByte.Common.dll
Syntax
public static class ForEachTask : Object
Methods
Create<T>(String, IEnumerable<T>, Action<T>, Action<T>)
Creates a new task that executes an action once for each element of a collection.
Declaration
public static ForEachTask<T> Create<T>(string name, IEnumerable<T> target, Action<T> action, Action<T> rollback = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | A name describing the task in human-readable form. |
IEnumerable<T> | target | A list of objects to execute the action for. Cancellation is possible between any two elements. |
Action<T> | action | The action to be executed once per element in |
Action<T> | rollback | An optional action to try to undo changes made by |
Returns
Type | Description |
---|---|
ForEachTask<T> |
Type Parameters
Name | Description |
---|---|
T |