CSharp Task Asynchronous Programming

Last Updated: 10/17/2021

Introduction

Task

  • Task represents an asynchronous operation.
  • Task parallelism refers to one or more independent tasks running concurrently.

Benefits of Task

  • Task are lightweight and you can create many of them to enable fine-grained parallelism.
  • More efficient and more scalable use of system resources.
  • More programmatic control than is possible with a thread or work item.

Task Parallel Library

  • Task Parallel Library (TPL) is based on the concept of a task
  • TPL provide a rich set of APIs that support waiting, cancellation, continuations, robust exception handling, detailed status, custom scheduling, and more.
  • TPL is the preferred API for writing multi-threaded, asynchronous, and parallel code in .NET.