Asynchronous Programming in .NET 4.5 (async and await)
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about keeping a GUI responsive or replacing ContinueWith and threads, as a practical introduction to async and await.
Recommended by 3 people across 3 different months, 2014 to 2016.
What it is
A recorded webcast by Michael Kennedy covering asynchronous programming in .NET 4.5 and C# 5.0. It introduces async methods and the await keyword, briefly reviews the Task Parallel library for background, and walks through a demo app. Visual Basic 11 shares the same features.
What people said
Recommends YoryeNathan · 2015-01 · Stack Overflow · on “Block Task.Run method until done”
You can read about the `ContinueWith` method of `Task`, or even better - the keywords `async` and `await`. Great video here [this video]
Recommends Maximilian Ast · 2015-07 · Stack Overflow · on “Button unable to click when Thread.Sleep”
you can use Async and Await here is a good tutorial in combination with an GUI: [this video] you need to declare your function as async public async void Foo() { ... } than you can use: await Task.Delay(10000); it will release you GUI for the whole Delay and you can use your GUI while the Delay is waiting.
Recommends TDull · 2016-10 · Stack Overflow · on “How to use thread when button click event in windows form?”
It's difficult to decide for you, how you should approach this problem. If you are using .NET 4.5 you could look into the async and await keywords. Video tutorial: [this video] If you are "locked" to .NET 3.5 or simply want to learn about the Backgroundworker this is a great opportunity, as it is scenarios like this it was built for. Doing work on a background thread and then update the UI can be a hassle, the advantage of using a Backgroundworker is that the events (ProgressChanged, RunworkerCompleted) are raised on the UI thread, so this is taken care of for you. Finally some general tips if you go for the Backgroundworker : The task you wish to perform is placed in the DoWork event Do not upda
Cites Assassinbeast · 2014-06 · Stack Overflow · on “Using async in async function?”
Hey thanks for answer! But are you sure about the ContinueWith() isn't legacy stuff? This video on youtube shows it: [this video] At 55:30, he says that the new async await feature will convert the stuff after await to Task.ContinueWith()