The newest version of .Net (v4.6) is adding just that, a built-in Task.CompletedTask:
Task completedTask = Task.CompletedTask;
That property is implemented as a no-lock singleton so you would almost always be using the same completed task.
More Related Contents:
- Running multiple async tasks and waiting for them all to complete
- Using async/await for multiple tasks
- StaTaskScheduler and STA thread message pumping
- TAP global exception handler
- Why should I prefer single ‘await Task.WhenAll’ over multiple awaits?
- Regarding usage of Task.Start() , Task.Run() and Task.Factory.StartNew()
- Task sequencing and re-entracy
- Synchronously waiting for an async operation, and why does Wait() freeze the program here
- How to use non-thread-safe async/await APIs and patterns with ASP.NET Web API?
- Enforce an async method to be called once
- Is there anything like asynchronous BlockingCollection?
- Cancelling a pending task synchronously on the UI thread
- What is the use for Task.FromResult in C#
- Waiting for async/await inside a task
- Revisiting Task.ConfigureAwait(continueOnCapturedContext: false)
- ConfigureAwait pushes the continuation to a pool thread
- How can I prevent synchronous continuations on a Task?
- If my interface must return Task what is the best way to have a no-operation implementation?
- multiple awaits vs Task.WaitAll – equivalent?
- Executing tasks in parallel
- Difference between returning and awaiting a Task in an async method [duplicate]
- Use Task.Run() in synchronous method to avoid deadlock waiting on async method?
- Task.Factory.StartNew with async lambda and Task.WaitAll
- A pattern for self-cancelling and restarting task
- How to correctly write Parallel.For with async methods
- What is the correct way to cancel an async operation that doesn’t accept a CancellationToken?
- Converting async/await to Task.ContinueWith
- The lack of non-capturing Task.Yield forces me to use Task.Run, why follow that?
- How do I get a return value from Task.WaitAll() in a console app?
- Wrapping ManualResetEvent as awaitable task