Search The Blog
About this site

@RoyOsherove

Subscribe!

This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

from 5whys.com
Twitter: @RoyOsherove
My Book: The Art of Unit Testing
Latest Posts
« Creating a better BackgroundWorker: CancelImmediately and other goodies | Main | A better Safe Cast using Generics »
Wednesday
Nov092005

A better BackgroundWorker : CancelImmediately and other goodies

One of the nice new features you get in .NET 2.0 Winforms is the new BackgroundWorker component. It allows safely executing long tasks in a different thread than the GUI, while allowing an easy event-driven interface to perform the task and respond to events (such as detecting work progress). There are even versions of this for .NET 1.1 courtesy of Juval Lowy.
One of the things it does not support is the ability to Cancel the running task immediately rather than waiting for the code to process the Cancel Request (which is vital if your “DoWork” code contains tasks that individually take a long time to process). With some Reflectoring, I was able to overcome this obstacle and provide a solution for this problem.
 
For the full details and download in VB.NET and C#, read the full article:

PrintView Printer Friendly Version

Reader Comments (1)

Hello,
I am not able to see the full article. can u please post it again

May 19, 2011 | Unregistered Commenterrooma

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>