Advertisement
Beginner C#, Asynchronous Programming

What is the difference between Task and Task<T>?

Short answer

Task represents async work with no result; Task completes with a value of type T that you get by awaiting it.

Save C# mock interview
Advertisement
AModel answer
Task represents async work with no result; Task<T> completes with a value of type T that you get by awaiting it.
Task done = Task.Delay(100);
Task<int> n = Task.FromResult(42);
int v = await n;
Real-world example
Returning Task<Order> from a repository so callers can await the fetched order.