NanoByte.Common
2.6.1
|
A task that performs an operation once for each element of a collection. More...
Public Member Functions | |
ForEachTask ([Localizable(true)] string name, IEnumerable< T > target, Action< T > work) | |
Creates a new for-each task. More... | |
![]() | |
void | Run (CancellationToken cancellationToken=default, ICredentialProvider? credentialProvider=null, IProgress< TaskSnapshot >? progress=null) |
Runs the task and blocks until it is complete. | |
Static Public Member Functions | |
static ForEachTask< T > | Create< T > ([Localizable(true)] string name, IEnumerable< T > target, Action< T > work) |
Creates a new for-each task. More... | |
Protected Member Functions | |
override void | Execute () |
The actual code to be executed. | |
Properties | |
override string | Name [get] |
override bool | UnitsByte [get] |
![]() | |
abstract string | Name [get] |
object? | Tag [get, set] |
virtual bool | CanCancel [get] |
TaskState | State [get, protected set] |
The current State of the task. More... | |
abstract bool | UnitsByte [get] |
true if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units. More... | |
long | UnitsProcessed [get, set] |
The number of units that have been processed so far. More... | |
long | UnitsTotal [get, set] |
The total number of units that are to be processed; -1 for unknown. More... | |
![]() | |
string | Name [get] |
A name describing the task in human-readable form. More... | |
object? | Tag [get, set] |
An object used to associate the task with a specific process; can be null . More... | |
bool | CanCancel [get] |
Indicates whether this task can be canceled once it has been started. More... | |
Additional Inherited Members | |
![]() | |
CancellationToken | CancellationToken |
Signaled when the user wishes to cancel the task execution. More... | |
ICredentialProvider? | CredentialProvider |
Used to retrieve credentials for specific Uris on demand; can be null . More... | |
A task that performs an operation once for each element of a collection.
Provides a static factory method for
as an alternative to calling the constructor to exploit type inference.
|
inline |
Creates a new for-each task.
name | A name describing the task in human-readable form. |
target | A list of objects to execute work for. Cancellation is possible between two elements. |
work | The code to be executed once per element in target . May throw WebException, IOException or OperationCanceledException. |
|
static |
Creates a new for-each task.
name | A name describing the task in human-readable form. |
target | A list of objects to execute work for. Cancellation is possible between two elements. |
work | The code to be executed once per element in target . May throw WebException, IOException or OperationCanceledException. |