Task-based Asynchronous Pattern (TAP) is now the recommended method to create asynchronous code. It executes asynchronously on a thread from the thread pool and does not execute synchronously on the main thread of your application. It allows us to check the task's state by calling the Status property.
Handling tasks in asynchronous programming
Getting ready
We will create a task to read a very large text file. This will be accomplished using an asynchronous Task. Be sure that you have added the using System.IO; namespace to your Windows forms application.
How to do it...
- Create a large text file (we called ours...