For example, you could have a class called Prime Number Calculator, have a method called Calculate() to calculate the numbers, and have an event called Primes Calculated when the calculation was complete), and the work is always going to return a string as a result (just for example's sake, you can change this, or make it more general if you wish (return a generic This concept is very closely related to the Event Based Asynchronous pattern, and, thus, in many cases, you may be able to use built in classes that already implement that pattern (or perhaps sub class those classes, and add custom functionality).
However, Tasks provide a number of beneficial, easy to use features that stand it apart from to the caller.
If you have a very long running task, it is potentially better, and more efficient to start a brand new, dedicated thread, rather than tie up a thread pool thread.
However, you then lose the benefit of having the 'fluffy', simple to use Task object to work with. Well, you can use the classes are for compute bound operations.
Before you begin this tutorial, you should have a solid base knowledge of all C#'s fundamental concepts, and have at least a general knowledge of the different API's available for performing multithreaded and asynchronous operations in C#.
The examples are kept very very simple, but basic knowledge is still required So, what has brought this on?
Note: if you wanted to pass arguments (state data) for use in the operation, you could store them arguments in properties in this class, passing them in via the .