How does C# 5.0's async-await feature differ from the TPL?

后端 未结 7 1691
孤城傲影
孤城傲影 2020-12-07 10:48

I don\'t see the different between C#\'s (and VB\'s) new async features, and .NET 4.0\'s Task Parallel Library. Take, for example, Eric Lippert\'s code from here:

         


        
7条回答
  •  孤街浪徒
    2020-12-07 11:02

    The await keyword does not introduce concurrency. It is like the yield keyword, it tells the compiler to restructure your code into lambda controlled by a state machine.

    To see what await code would look like without 'await' see this excellent link: http://blogs.msdn.com/b/windowsappdev/archive/2012/04/24/diving-deep-with-winrt-and-await.aspx

提交回复
热议问题