Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is async and await and when would you use these in windows development?

I have always seen the keywords async used in Silverlight but was wondering if there is someone with a dummy's explanation of what it is and when to use it and its benefits. Please if you can explain, will be greatly appreciative. Thank you.

like image 484
Donald N. Mafa Avatar asked Jan 18 '12 06:01

Donald N. Mafa


People also ask

What are async and await and why it is used?

An async function is a function declared with the async keyword, and the await keyword is permitted within it. The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains.

Why do we use async and await in C #?

The async keyword turns a method into an async method, which allows you to use the await keyword in its body. When the await keyword is applied, it suspends the calling method and yields control back to its caller until the awaited task is complete. await can only be used inside an async method.

Do we need to use async and await?

“async” keyword needs to be updated in front of functions that contain ”await” keyword to notify that the result might be available after a certain delay since we are explicitly making the main thread wait until the promise has been resolved. Await and Async has introduced synchronous behavior to the Execution.

What is async await in programming?

In computer programming, the async/await pattern is a syntactic feature of many programming languages that allows an asynchronous, non-blocking function to be structured in a way similar to an ordinary synchronous function.


2 Answers

Start with my introductory article in MSDN magazine.

And then read the papers on the async CTP site.

And then read these fifteen articles:.

If you still have questions after all that, try asking at the async forum.

like image 71
Eric Lippert Avatar answered Oct 16 '22 17:10

Eric Lippert


Have a look at this blog post, it gives a nice introduction and explanation of what async and await are.

If you want to really understand it, have a look at Jon Skeet's series on async and await

like image 23
Emond Avatar answered Oct 16 '22 17:10

Emond