From the course: Advanced Threading in C#

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

TAP introduction

TAP introduction - C# Tutorial

From the course: Advanced Threading in C#

Start my 1-month free trial

TAP introduction

- [Instructor] In .NET framework 2.0, there was a pattern that was called EAP, or event-based asynchronous pattern. Later, with the introduction of tasks, task-based asynchronous pattern is the recommended way of doing task-based programming. This is also know as TAP and it's a very simple pattern. There are only a few things that we need to keep in mind and if we have all of them in our asynchronous solution, then that means it follows the TAP pattern. So first, it should be returning a hot-running task, we can also use a task of any type, like a result type which could be task of day time, task of integer, or anything like task of employee, product, or any other class you create. But it should return a hot-running task. Second, if we do use an Async mechanism, we need to make sure that the method has a suffix that's called Async. Now except for special cases such as task combinators, for the most part we will have this. We also need to make sure that it is overloaded to accept a…

Contents