Прочетете на английски Редактиране

Споделяне чрез


ValueTask.FromException Method

Definition

Overloads

FromException(Exception)

Creates a ValueTask that has completed with the specified exception.

FromException<TResult>(Exception)

Creates a ValueTask<TResult> that has completed with the specified exception.

FromException(Exception)

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

Creates a ValueTask that has completed with the specified exception.

C#
public static System.Threading.Tasks.ValueTask FromException(Exception exception);

Parameters

exception
Exception

The exception with which to complete the task.

Returns

The faulted task.

Applies to

.NET 10 и други версии
Продукт Версии
.NET 5, 6, 7, 8, 9, 10

FromException<TResult>(Exception)

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

Creates a ValueTask<TResult> that has completed with the specified exception.

C#
public static System.Threading.Tasks.ValueTask<TResult> FromException<TResult>(Exception exception);

Type Parameters

TResult

The type of the result of the returned task.

Parameters

exception
Exception

The exception with which to complete the task.

Returns

The faulted task.

Applies to

.NET 10 и други версии
Продукт Версии
.NET 5, 6, 7, 8, 9, 10