Table of Contents

Class TaskExtensions

Namespace
MADE.Threading
Assembly
MADE.Threading.dll

Defines a collection of extensions for tasks.

public static class TaskExtensions
Inheritance
TaskExtensions
Inherited Members

Methods

AndObserveExceptions(Task, Action<Exception>?)

Observes the exceptions of faulted tasks.

public static Task AndObserveExceptions(this Task task, Action<Exception>? onException = null)

Parameters

task Task

The task to observe for exceptions.

onException Action<Exception>

An action invoked when an exception is caught.

Returns

Task

An asynchronous operation.

Exceptions

Exception

Potentially thrown by the onException delegate callback.

AndObserveExceptions<T>(Task<T>, Action<Exception>?)

Observes the exceptions of faulted tasks.

public static Task<T> AndObserveExceptions<T>(this Task<T> task, Action<Exception>? onException = null)

Parameters

task Task<T>

The task to observe for exceptions.

onException Action<Exception>

An action invoked when an exception is caught.

Returns

Task<T>

An asynchronous operation.

Type Parameters

T

The instance type for the listener.

Exceptions

Exception

Potentially thrown by the onException delegate callback.

WhenAll(IEnumerable<Task>)

Creates a task that will complete when all of the Task objects in the collection have completed.

public static Task WhenAll(this IEnumerable<Task> tasks)

Parameters

tasks IEnumerable<Task>

The tasks to wait on for completion.

Returns

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 Task objects in the collection have completed.

public static Task WhenAny(this IEnumerable<Task> tasks)

Parameters

tasks IEnumerable<Task>

The tasks to wait on for completion.

Returns

Task

A task that represents the completion of one of the supplied tasks.