Skip to main content
InterviewHubPRO
Section Overview
Q10

Question 10 of 50

Part 1: Core Language, CLR & Memory Architecture (1 - 10)

20%
C# & CLR Internals (50 Qs)•Part 1: Core Language, CLR & Memory Architecture (1 - 10)

What is the difference between `Task.Run` vs. `Task.Yield` vs. `ValueTask<T>`?

senior LevelSystem Design

In Simple Words:

  • Task.Run: Queues CPU-bound work to run on a background ThreadPool thread. Never use for I/O-bound operations.
  • Task.Yield: Forces the current method to yield execution asynchronously, re-queuing the continuation back to the dispatcher.
  • ValueTask<T>: A struct-based task representation that avoids heap allocation when an asynchronous method completes synchronously (e.g. returning cached results).