I wrote about fast path optimizations with having already completed task prepared before in my “Better “cached completed Task””. At that time the was no way to directly access already completed
Task the TPL has.
Although you could do it using the trick described there, it was really looking cryptic for somebody reading the code. You could wrap it into your own well-named property, but you know…
Luckily in .NET 4.6 the before
Task.CompletedTask property is now
public. It’s not that it will make your code faster than before. Really not. It’s just ready there for you to use. And because of the name the code will also look more self-descriptive.
Now to just wait for .NET 4.6 to RTM.