Task-based Asynchronous pattern is the recommended pattern for using concurrency. It's the same pattern for both IO and computation intensive concurrency. Walk through a demonstration of TAP using cancellation tokens.
- [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 cancellation token,…and or an eye progress of type T…
- Thread safety and affinity
- Task Parallel Library (TPL) basics
- PLINQ introduction
- Task-based Asynchronous Pattern (TAP)