Task.FromCanceled method (1 of 2)

Creates a Task that is completed due to cancellation with a specified cancellation token.

public static Task FromCanceled(CancellationToken cancellationToken)
parameter description
cancellationToken The cancellation token with which to complete the task.

Return Value

The canceled task.

See Also


Task.FromCanceled<TResult> method (2 of 2)

Creates a Task that is completed due to cancellation with a specified cancellation token.

public static Task<TResult> FromCanceled<TResult>(CancellationToken cancellationToken)
parameter description
TResult The type of the result returned by the task.
cancellationToken The cancellation token with which to complete the task.

Return Value

The canceled task.

See Also