Represented by:
- System.Threading.Tasks.TaskFactory which has no return type object.
- System.Threading.Tasks.TaskFactory<TResult> which has TResult as return type.
Important Note:
- Runs the task immediately after creating the task .This type of execution is known as Task Parallelism.
- Runs the task in a pre-defined order. This type of execution is known as Continuation Tasks.
- Running the task by pair. That is in Asynchronous programming model.
Now let’s look deep into Task Parallelism.
- Task parallel library is used to perform asynchronous operation.
- The task that are invoked by Task Parallelism is invoked by are independent of one another.
- Parallel.Invoke(() => Console.WriteLine("Perform Operatrion 1"), () =>Console.WriteLine("Perform Operatrion 2"));
- The Task are separated by “,”. They are independent of one another.
- These task are actually queued in ThreadPool.
- It provides many enhancements such as waiting, cancellation, continuations, exception handling, detailed status, custom scheduling, and more.
- It takes Action delegate as input, that is the return type is always void.
- Task.Run method create and start a task in one operation, that is in one step.
- TaskFactory.StartNew is also used to create and start a task in one operation.
Code sample

Join the conversation! Your thoughts help the community grow.