Class TaskExtensions
Defines a collection of extensions for tasks.
Inheritance
Namespace: MADE.Threading
Assembly: MADE.Threading.dll
Syntax
public static class TaskExtensions : object
Methods
| Improve this Doc View SourceAndObserveExceptions(Task, Action<Exception>)
Observes the exceptions of faulted tasks.
Declaration
public static Task AndObserveExceptions(this Task task, Action<Exception> onException = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Task | task | The task to observe for exceptions. |
| Action<Exception> | onException | An action invoked when an exception is caught. |
Returns
| Type | Description |
|---|---|
| Task | An asynchronous operation. |
AndObserveExceptions<T>(Task<T>, Action<Exception>)
Observes the exceptions of faulted tasks.
Declaration
public static Task<T> AndObserveExceptions<T>(this Task<T> task, Action<Exception> onException = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Task<T> | task | The task to observe for exceptions. |
| Action<Exception> | onException | An action invoked when an exception is caught. |
Returns
| Type | Description |
|---|---|
| Task<T> | An asynchronous operation. |
Type Parameters
| Name | Description |
|---|---|
| T | The instance type for the listener. |
WhenAll(IEnumerable<Task>)
Creates a task that will complete when all of the
Declaration
public static async Task WhenAll(this IEnumerable<Task> tasks)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Task> | tasks | The tasks to wait on for completion. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the completion of all of the supplied tasks. |
WhenAny(IEnumerable<Task>)
Creates a task that will complete when any of the
Declaration
public static async Task WhenAny(this IEnumerable<Task> tasks)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Task> | tasks | The tasks to wait on for completion. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the completion of one of the supplied tasks. |