Show / Hide Table of Contents

Class Continuation

Represents various continuations.

Inheritance
Object
Continuation
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Threading.Tasks
Assembly: DotNext.dll
Syntax
public static class Continuation

Methods

| Improve this Doc View Source

ContinueWithTimeout<T>(Task<T>, TimeSpan, CancellationToken)

Attaches timeout and, optionally, token to the task.

Declaration
public static Task<T> ContinueWithTimeout<T>(this Task<T> task, TimeSpan timeout, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Task<T> task

The source task.

TimeSpan timeout

The timeout of the asynchronous task.

CancellationToken token

The token that can be used to cancel the constructed task.

Returns
Type Description
Task<T>

The task with attached timeout and token.

Type Parameters
Name Description
T

The type of the task.

Exceptions
Type Condition
ArgumentOutOfRangeException

timeout is negative.

OperationCanceledException

The operation has been canceled.

TimeoutException

The timeout has occurred.

| Improve this Doc View Source

OnCanceled<T, TConstant>(Task<T>, TaskScheduler)

Returns constant value if underlying task is canceled.

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

    where TConstant : Constant<T>, new()
Parameters
Type Name Description
Task<T> task

The task to check.

TaskScheduler scheduler

Optional scheduler used to schedule continuation.

Returns
Type Description
Task<T>

The task representing continuation.

Type Parameters
Name Description
T

The type of task result.

TConstant

The type describing constant value.

Remarks

This continuation doesn't produce memory pressure. The delegate representing continuation is cached for future reuse as well as constant value.

| Improve this Doc View Source

OnCompleted(Task)

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

Declaration
public static Task<Task> OnCompleted(this Task task)
Parameters
Type Name Description
Task task

The task to await.

Returns
Type Description
Task<Task>

task in final state.

| Improve this Doc View Source

OnCompleted<TResult>(Task<TResult>)

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

Declaration
public static Task<Task<TResult>> OnCompleted<TResult>(this Task<TResult> task)
Parameters
Type Name Description
Task<TResult> task

The task to await.

Returns
Type Description
Task<Task<TResult>>

task in final state.

Type Parameters
Name Description
TResult

The type of the task result.

| Improve this Doc View Source

OnFaulted<T, TConstant>(Task<T>, TaskScheduler)

Returns constant value if underlying task is failed.

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

    where TConstant : Constant<T>, new()
Parameters
Type Name Description
Task<T> task

The task to check.

TaskScheduler scheduler

Optional scheduler used to schedule continuation.

Returns
Type Description
Task<T>

The task representing continuation.

Type Parameters
Name Description
T

The type of task result.

TConstant

The type describing constant value.

Remarks

This continuation doesn't produce memory pressure. The delegate representing continuation is cached for future reuse as well as constant value.

| Improve this Doc View Source

OnFaultedOrCanceled<T, TConstant>(Task<T>, TaskScheduler)

Returns constant value if underlying task is failed or canceled.

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

    where TConstant : Constant<T>, new()
Parameters
Type Name Description
Task<T> task

The task to check.

TaskScheduler scheduler

Optional scheduler used to schedule continuation.

Returns
Type Description
Task<T>

The task representing continuation.

Type Parameters
Name Description
T

The type of task result.

TConstant

The type describing constant value.

Remarks

This continuation doesn't produce memory pressure. The delegate representing continuation is cached for future reuse as well as constant value.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX