ValueTask<TResult> Constructors
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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. |
- 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
.NET 9 and other versions
Product | Versions |
---|---|
.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 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided), 2.1 |
- 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
.NET 9 and other versions
Product | Versions |
---|---|
.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 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided), 2.1 |
- 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
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided), 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: