Task.CompletedTask and Task.Result Tips

added by DotNetKicks
1/18/2018 2:19:27 PM

2 Kicks, 373 Views

In any method returning a Task, it is desirable to avoid using Task.Run if you can compute a result without going async. For example, if logic allows you to short-circuit a computation, or if you have a fake method in a test returning a pre-computed answer, then you don't need to use Task.Run.


0 comments