ValueTask.FromCanceled Method

Definition

Overloads

FromCanceled(CancellationToken)

Creates a ValueTask that has completed due to cancellation with the specified cancellation token.

FromCanceled<TResult>(CancellationToken)

Creates a ValueTask<TResult> that has completed due to cancellation with the specified cancellation token.

FromCanceled(CancellationToken)

Source:
ValueTask.cs
Source:
ValueTask.cs
Source:
ValueTask.cs

Creates a ValueTask that has completed due to cancellation with the specified cancellation token.

C#
public static System.Threading.Tasks.ValueTask FromCanceled(System.Threading.CancellationToken cancellationToken);

Parameters

cancellationToken
CancellationToken

The cancellation token with which to complete the task.

Returns

The canceled task.

Applies to

.NET 10 y otras versiones
Producto Versiones
.NET 5, 6, 7, 8, 9, 10

FromCanceled<TResult>(CancellationToken)

Source:
ValueTask.cs
Source:
ValueTask.cs
Source:
ValueTask.cs

Creates a ValueTask<TResult> that has completed due to cancellation with the specified cancellation token.

C#
public static System.Threading.Tasks.ValueTask<TResult> FromCanceled<TResult>(System.Threading.CancellationToken cancellationToken);

Type Parameters

TResult

The type of the result of the returned task.

Parameters

cancellationToken
CancellationToken

The cancellation token with which to complete the task.

Returns

The canceled task.

Applies to

.NET 10 y otras versiones
Producto Versiones
.NET 5, 6, 7, 8, 9, 10