Search code examples
c#task-parallel-librarybackgroundworker.net-4.5async-await

Async/await vs BackgroundWorker


In the past few days I have tested the new features of .net 4.5 and c# 5.

I like its new async/await features. Earlier I had used BackgroundWorker to handle longer processes in the background with responsive UI.

My question is: after having these nice new features, when should I use async/await and when a BackgroundWorker? Which are the common scenarios for both?


Solution

  • async/await is designed to replace constructs such as the BackgroundWorker. While you certainly can use it if you want to, you should be able to use async/await, along with a few other TPL tools, to handle everything that's out there.

    Since both work, it comes down to personal preference as to which you use when. What is quicker for you? What is easier for you to understand?