Asynchronous calls with the new keyword 'wait'

Today I used asynchronization methods, calling methods asynchronously and using calling method callback methods.

Recently, I can through this post , which talks about a new way to do this, using a new keyword await. Unlike saving multiple lines of code, what are the main benefits of this new model?

Does this offer a built-in solution when you make two different asynchronous calls, but want the control to return to only one of the caller's callbacks after both are completed?

What does CTP (Community Technical Preview) mean? Is this new keyword available in the next version of C # and VB.NET?

+3
source share
3 answers

From Eric Lippert Blog Post Asynchrony in C # 5, Part One

C # 5.0 designers realized that writing asynchronous code is painful, in many ways. Asynchronous code is difficult to reason about, and as we can see, the conversion to continuation is complex and leads to code replete with mechanisms that hide the meaning of the code.

As the article says, like iterator blocks, anonymous methods, understanding queries and dynamic types, the goal is to make something difficult and easy.

. , "" #, , - . , - ( ) .

+4

, " " . await , , .

, , .. .

Async CTP Word, . , . "Asynchrony in.NET.docx" , , .

+3

async, "". , , Task.ContinueWhenAll.

Regarding CTP, this means that it is in the alpha stage and may contain errors and is not completed (may change in the future). For example - the keyword β€œwait” will change to something else or will have different syntax rules).

+1
source

Source: https://habr.com/ru/post/1781266/


All Articles