ValueTask<TResult> Constructors

Definition

Overloads

ValueTask<TResult>(Task<TResult>)

Initializes a new instance of the ValueTask<TResult> class using the supplied task that represents the operation.

ValueTask<TResult>(TResult)

Initializes a new instance of the ValueTask<TResult> class using the supplied result of a successful operation.

ValueTask<TResult>(IValueTaskSource<TResult>, Int16)

Initializes a new instance of the ValueTask<TResult> class with a IValueTaskSource<TResult> object that represents the operation.

ValueTask<TResult>(Task<TResult>)

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

Initializes a new instance of the ValueTask<TResult> class using the supplied task that represents the operation.

C#
public ValueTask(System.Threading.Tasks.Task<TResult> task);

Parameters

task
Task<TResult>

The task.

Exceptions

The task argument is null.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

ValueTask<TResult>(TResult)

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

Initializes a new instance of the ValueTask<TResult> class using the supplied result of a successful operation.

C#
public ValueTask(TResult result);

Parameters

result
TResult

The result.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

ValueTask<TResult>(IValueTaskSource<TResult>, Int16)

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

Initializes a new instance of the ValueTask<TResult> class with a IValueTaskSource<TResult> object that represents the operation.

C#
public ValueTask(System.Threading.Tasks.Sources.IValueTaskSource<TResult> source, short token);

Parameters

source
IValueTaskSource<TResult>

The source.

token
Int16

An opaque value that is passed to the IValueTaskSource.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1