If I have a method like
Task<bool> LongProcessTaskAsync();
Would it be a better practice to return a started task
return Task<bool>.Factory.StartNew(() => { ... });
or just return new Task<bool>(() => ...)
Personally, I prefer the first method but I’d rather be consistent will other API’s and libraries.
Is returning a not-started task ever more appropriate?
In the case of async/await methods, the Task will already be started. AFAIK, all the BCL methods added for Task-based versions return already-started Tasks. It would be kinda weird not to, since the common consumer case is now:
[EDIT] Based on Stephen pointing out that the TAP guidelines covers this (and he already includes a link to the guidelines), I’ll include a quote of the relevant bit from page 4 (in The Task-based Asynchronous Pattern Defined -> Behavior -> Task Status), and I’ve added bold+italics around the key parts.