-
Book Overview & Buying
-
Table Of Contents
Visual Studio 2010 Best Practices
By :
In .NET 4.0, the TPL was introduced into the .NET class library. .NET provides a lot of threading and thread safety capabilities. The TPL makes parallelization in .NET applications easier. Before we get into too much detail about using it for parallelization and asynchrony, let's cover some TPL fundamentals first.
The TPL introduces a high-level threading abstraction called a Task. Tasks are used to model individual operations that can be executed, including asynchronously or in parallel. Prior to the TPL, the work involved in an operation was modeled as a single delegate, and didn't provide an object-oriented interface for dealing with asynchronous operations as abstractions, encapsulating state and other properties such as exception, status, and optional result.
Tasks effectively wrap a delegate in a similar way as threading was done before TPL.
Creating tasks are easy. They can be created from a member method or an anonymous method. For example, we can create...
Change the font size
Change margin width
Change background colour