Free mag vol1 | Page 801

CHAPTER 19  MULTITHREADED, PARALLEL, AND ASYNC PROGRAMMING Now, notice that we are required to make use of the Task class from the System.Threading.Tasks namespace in order to refactor our DoWork() method to work as expected. Basically, rather than returning a specific return value straightaway (a string object in the current example), we return a Task object, where the generic type parameter T is the underlying, actual return value (with me so far?). The implementation of DoWork() now directly returns a Task object, which is the return value of Task.Run(). The Run() method takes a չ