C# language feature:
applies to
benefit
ValueTask<TResult>
. Previously async types were limited to returning void
, Task
, Task<T>
. Use of Task<T>
requires allocating object which hinders performance.how to use
ValueTask<TResult>
as the return type.important note
ValueTask<TResult>
, add NuGet package System.Threading.Tasks.Extensions to your project.example: