async-await 模式是.NET中功能更强大的功能之一4.5和C#5.0
The async-await pattern is one of the more powerful additions to .NET 4.5 and C# 5.0
据我所知,它目前仅在C#和VB中可用.
It is currently only available in C# and VB as far as I know.
此API是.NET CLR还是C#编译器本身的功能?
Is this API a feature of the .NET CLR or of the C# compiler itself?
我真正要问的是-我们是否应该期望在其他.NET语言中进行异步/等待,例如:
What I'm really asking is this - should we expect async/await in the other .NET languages such as:
- C ++(通过C ++/CLI)
- Python(通过IronPython)
- PHP(通过Phalanger)
- JavaScript(通过IronJS)
请注意,我并不是一般地询问异步编程,而是询问async-await模式(同步编写的异步代码)的细节.
Please note I'm not asking about asynchronous programming in general, but about the specifics of the async-await pattern (asynchronous code which is written synchronously).
推荐答案
此API是.NET CLR还是C#编译器本身的功能?
Is this API a feature of the .NET CLR or of the C# compiler itself?
这是编译器的功能.支持async和await不需要CLR更改.其他语言将需要扩展以支持它.没有什么可以阻止编译器执行此操作,但是必须在编译器和语言本身中对其进行更改.
This is a feature of the compiler. There were no CLR changes required to support async and await. Other languages would need to be extended to support it. There is nothing preventing a compiler from doing this, but it would have to be changed in the compiler and language itself.
C ++确实通过task支持某些 Windows Store应用程序中的异步/then,尽管它不如C#和VB中的async/await关键字有用.
C++ does support some asynchrony in Windows Store applications via task/then, though it's not as usable as the async/await keywords in C# and VB.
据我所知,目前仅在C#和VB中可用
It is currently only available in C# and VB as far as I know
请注意,F#也具有async支持(比C#和VB.Net版本早很多).它不同于C#样式异步支持,但类似(并启发了C#和VB.Net团队).
Note that F# also has async support (which predates the C# and VB.Net versions by quite a bit). It is different than the C# style async support, but similar (and inspired the C# and VB.Net teams).
更多推荐
除C#之外,async
发布评论