Class Continuation
Represents various continuations.
Namespace: DotNext.Threading.Tasks
Assembly: DotNext.dll
Syntax
public static class Continuation : object
Methods
| Improve this Doc View SourceOnCanceled<T, C>(Task<T>, TaskScheduler)
Returns constant value if underlying task is canceled.
Declaration
public static Task<T> OnCanceled<T, C>(this Task<T> task, TaskScheduler scheduler = null)
where C : 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. |
C | 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.
OnCompleted(Task)
Allows to obtain original 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> |
|
OnCompleted<R>(Task<R>)
Allows to obtain original await
without
throwing exception produced by this task.
Declaration
public static Task<Task<R>> OnCompleted<R>(this Task<R> task)
Parameters
Type | Name | Description |
---|---|---|
Task<R> | task | The task to await. |
Returns
Type | Description |
---|---|
Task<Task<R>> |
|
Type Parameters
Name | Description |
---|---|
R | The type of the task result. |
OnFaulted<T, C>(Task<T>, TaskScheduler)
Returns constant value if underlying task is failed.
Declaration
public static Task<T> OnFaulted<T, C>(this Task<T> task, TaskScheduler scheduler = null)
where C : 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. |
C | 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.
OnFaultedOrCanceled<T, C>(Task<T>, TaskScheduler)
Returns constant value if underlying task is failed or canceled.
Declaration
public static Task<T> OnFaultedOrCanceled<T, C>(this Task<T> task, TaskScheduler scheduler = null)
where C : 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. |
C | 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.