除C#之外,async

编程入门 行业动态 更新时间:2024-10-28 08:31:30
本文介绍了除C#之外,async-await是否可以在其他.NET语言中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

本文发布于:2023-11-04 00:26:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1556465.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:async

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!