welcome async/await, goodbye BackgroundWorker
There are a lot of choice for us for doing asynchronous work in UI. Which one is the best ? Can async/await replace BackgroundWorkder completely
async/await should replace your old BackgroundWorker. That’s it ! Why ?
MSDN explain about this.. Check this out
The async-based approach to asynchronous programming is preferable to existing approaches in almost every case. In particular, this approach is better than BackgroundWorker for IO-bound operations because the code is simpler and you don’t have to guard against race conditions. In combination with Task.Run, async programming is better than BackgroundWorker for CPU-bound operations because async programming separates the coordination details of running your code from the work that Task.Run transfers to the threadpool.
Ok. async/await is cool. But how to show the progress with async/await ? Can we do that. We need progress and cancel feature !
Of course we can !
You should visit this awesome blog post.
Cheers