Task vs ValueTask in C#: Making the Right Choice for Performance
Task vs ValueTask in C#: When to Choose Each One When writing async code in C#, most of us just use Task and Task<T> without thinking twice. But there’s this other option called ValueTask that can actually speed up your code in some situations. Let’s look at what makes these two different and how to pick the right one for your code. The Basics: Task and ValueTask Let’s start with what these two types actually are. ...