---
title: "What is the difference between Task and ValueTask in practice?"  
description: "What is the difference between Task and ValueTask in practice?"  
author: "Magdalena Michalska"  
published: 2026-11-13  
updated: 2026-11-13  
canonical: https://www.mindstick.com/forum/163009/what-is-the-difference-between-task-and-valuetask-in-practice  
category: "C# and .NET"  
tags: ["c#", "ValueTask", "Task", "Async", "performance"]  
reading_time: 1 minute  

---

# What is the difference between Task and ValueTask in practice?

A library I use returns ValueTask instead of Task. Should I use ValueTask in my own code?

## Replies

### Reply by Ayesha Achakzai

Task is a class, so each async call that actually has to wait allocates an object. ValueTask is a struct that can wrap either a ready result or a Task, so a method that often finishes synchronously (for example, a cache hit) can return without any allocation.

Use ValueTask when:

- the method is called very often, and
- it frequently completes synchronously.

For everything else, Task is simpler and safer. ValueTask has rules: you should await it only once, you should not await it from several places at the same time, and you should not call .Result before it finishes. Breaking these gives bugs that are hard to find.

If you are writing normal application code such as controllers and services, stay with Task. Measure first before switching a hot path to ValueTask.


---

Original Source: https://www.mindstick.com/forum/163009/what-is-the-difference-between-task-and-valuetask-in-practice

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
