Edit

Share via


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.

public:
 ValueTask(System::Threading::Tasks::Task<TResult> ^ task);
public ValueTask (System.Threading.Tasks.Task<TResult> task);
new System.Threading.Tasks.ValueTask<'Result> : System.Threading.Tasks.Task<'Result> -> System.Threading.Tasks.ValueTask<'Result>
Public Sub New (task As Task(Of TResult))

Parameters

task
Task<TResult>

The task.

Exceptions

The task argument is null.

Applies to

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.

public:
 ValueTask(TResult result);
public ValueTask (TResult result);
new System.Threading.Tasks.ValueTask<'Result> : 'Result -> System.Threading.Tasks.ValueTask<'Result>
Public Sub New (result As TResult)

Parameters

result
TResult

The result.

Applies to

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.

public:
 ValueTask(System::Threading::Tasks::Sources::IValueTaskSource<TResult> ^ source, short token);
public ValueTask (System.Threading.Tasks.Sources.IValueTaskSource<TResult> source, short token);
new System.Threading.Tasks.ValueTask<'Result> : System.Threading.Tasks.Sources.IValueTaskSource<'Result> * int16 -> System.Threading.Tasks.ValueTask<'Result>
Public Sub New (source As IValueTaskSource(Of TResult), token As Short)

Parameters

source
IValueTaskSource<TResult>

The source.

token
Int16

An opaque value that is passed to the IValueTaskSource.

Applies to