O'Reilly logo

Visual Studio 2012 and .NET 4.5 Expert Development Cookbook by Abhishek Sur

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Event-based asynchronous pattern and BackgroundWorker

EAP is a model that has also been introduced to handle threading in an easier and elegant way. The Event-based asynchronous pattern forms few rules that you need to follow while following the pattern. The implementation of Event-based Asynchronous pattern has been widely accepted, which uses events to notify the caller with the changes to the thread.

Getting ready

In this recipe, we are going to show an example of the BackgroundWorker type rather than implementing a new EAP class which will use ThreadPool in the background and run the method that is passed to it asynchronously. The BackgroundWorker class has special features like ProgressReport, CompleteCallback, or even cancellation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required