Task parallel library replacement for BackgroundWorker?

Does the task parallel library have anything that would be considered a replacement or improvement over the BackgroundWorker class?

I have a WinForms application with a wizard-style UI, and it does some long-running tasks. I want to be able to have a responsive UI with the standard progress bar and ability to cancel the operation. I've done this before with BackgroundWorker, but I'm wondering if there are some TPL patterns that can be used instead?


The Task class is an improvement over the BackgroundWorker; it naturally supports nesting (parent/child tasks), uses the new cancellation API, task continuations, etc.

I have an example on my blog, showing the old BackgroundWorker way of doing things and the new Task way of doing things. I do have a small helper class for tasks that need to report progress, because I find the syntax rather awkward. The example covers result values, error conditions, cancellation, and progress reporting.

Background worker is still a valid way of achieving this - if you are running multiple large operations concurrently then the parallel extensions would be worth considering, if its just the one then I would stick with the backgroundworker.

Need Your Help

How to get ER model of database from server with Workbench

mysql entity-relationship mysql-workbench

Is there any way to get an ER model of a database from the server that is connected to my MySQL Workbench?

How do I set the maximum line length in PyCharm?

python pycharm pep8

I am using PyCharm on Windows and want to change the settings to limit the maximum line length to 79 characters, as opposed to the default limit of 120 characters.