Reusing Task<T> in .NET core/.NET Standard

Viewed 426

Is it possible to reuse the same Task<T> created with Task.FromResult for instant returning methods (as it is completed already anyway)?

My reasoning behind the question is to reduce garbage produced by implementations of async interfaces that complete instantly (Task<bool> would be a great example for it, as it only has two possible values).

Base on this article about disposing of tasks, it should be possible, if .NET Core behaves the same (does it?).

1 Answers
Related