The async
and await
keywords will not make your application more responsive on their own. They simply make the calling and handling of methods that return Task
objects more convenient. In order to make async
/await
actually use background threads, you will need to combine with the usage of things like:
Task.Start()
- Starts a given task using the TaskScheduler
.
- PLINQ - Execute a series of operations in parallel, returns a Task.
TaskCompletionSource
- A custom way to handle async tasks. One place I used this was to handle events coming from a WebBrowser
control.
- Other
async
methods, such as many of the functions in the Win 8 API.
In other words, async
/await
is an extension of the Task-Based Asynchronous Pattern. You can find a large host of information, including many samples, here.
The BackgroundWorker
is a WinForms component that creates 1 background thread using the Event-Based Asynchronous pattern, and you can populate the work done on this background thread with your own code in the DoWork
event handler. In general, Microsoft no longer recommends using this pattern (see the bottom of the page here), though if you are familiar with it already it may still be a simple option.
Another option not mentioned, is the Reactive Extensions for .NET. This is another great framework for adding responsiveness to your apps.