Interface ITask
Represents an operation that can be cancelled and have its progress tracked.
public interface ITask
- Extension Methods
Properties
CanCancel
Indicates whether this task can be canceled once it has been started.
bool CanCancel { get; }
Property Value
- bool
Name
A name describing the task in human-readable form.
string Name { get; }
Property Value
- string
Tag
An object used to associate the task with a specific process; can be null
.
object? Tag { get; set; }
Property Value
- object
Methods
Run(CancellationToken, ICredentialProvider?, IProgress<TaskSnapshot>?)
Runs the task and blocks until it is complete.
void Run(CancellationToken cancellationToken = default, ICredentialProvider? credentialProvider = null, IProgress<TaskSnapshot>? progress = null)
Parameters
cancellationToken
CancellationTokenUsed to receive a signal (e.g. from another thread) when the user wants to cancel the task.
credentialProvider
ICredentialProviderObject used to retrieve credentials for specific System.Uris on demand; can be
null
.progress
IProgress<TaskSnapshot>Used to report back the task's progress (e.g. to another thread).
Exceptions
- OperationCanceledException
The task was canceled from another thread.
- IOException
The task ended with IOError.
- WebException
The task ended with WebError.
- See Also