Not a subject expert I'm trying to understand more of the async world available in .NET. Task.Run and ThreadPool.QueueUserWorkItem both allow dispatching work on a pool thread but what are the differences or, if you prefer, pros and cons of the two? Following is my list of pros. Not sure if it is complete or even correct.
ThreadPool.QueueUserWorkItem pros:
- Possibility of passing an argument
Task.Run pros:
- Possibility of providing a CancellationToken
- Possibility of waiting Task completion
- Possibility of returning a value to calling code