DotNext by Roman Sakno

<PackageReference Include="DotNext" Version="3.2.0" />

 Continuation

public static class Continuation
Represents various continuations.
public static Task<T> ContinueWithTimeout<T>(this Task<T> task, TimeSpan timeout, CancellationToken token = default)

Attaches timeout and, optionally, token to the task.

public static Task<T> OnCanceled<T, TConstant>(this Task<T> task, TaskScheduler scheduler = null) where TConstant : Constant<T>

Returns constant value if underlying task is canceled.

public static Task<Task> OnCompleted(this Task task)

Allows to obtain original Task in its final state after await without throwing exception produced by this task.

public static Task<Task<TResult>> OnCompleted<TResult>(this Task<TResult> task)

Allows to obtain original Task<T> in its final state after await without throwing exception produced by this task.

public static Task<T> OnFaulted<T, TConstant>(this Task<T> task, TaskScheduler scheduler = null) where TConstant : Constant<T>

Returns constant value if underlying task is failed.

public static Task<T> OnFaulted<T, TConstant>(this Task<T> task, Predicate<AggregateException> filter, TaskScheduler scheduler = null) where TConstant : Constant<T>

Returns constant value if underlying task is failed with the exception that matches to the filter.

public static Task<T> OnFaultedOrCanceled<T, TConstant>(this Task<T> task, TaskScheduler scheduler = null) where TConstant : Constant<T>

Returns constant value if underlying task is failed or canceled.

public static Task<T> OnFaultedOrCanceled<T, TConstant>(this Task<T> task, Predicate<AggregateException> filter, TaskScheduler scheduler = null) where TConstant : Constant<T>

Returns constant value if underlying task is canceled or failed with the exception that matches to the filter.