2014-08-29 56 views
1

我想尝试“新”async/await(是的,我迟到了派对),所以我启动了LINQPad 4.5。 1这是目前最新的非测试版。切换到“C#程序”并输入以下代码后,无评论;无法在LINQPad中使用异步/等待 - “无效的标记{在async后} ..”

// "Invalid token 'void' in class, struct, or interface member declaration" 
// - But compiles with `async` removed 
async void foo() { 
} 

void Main() 
{ 
    foo(); 
} 

但它......“不起作用”,如所示。

这个错误似乎表明LINQPad是用C#4,不C#5虽然网站没有说“LINQPad支持C#5.0和框架4.x的一切”和others don't seem to have this problem

什么原因导致了这个错误,怎么解决?

回答

1

那么,那是我的愚蠢。当前机器已安装.NET 4 - 而不是 4.5。

安装.NET 4.5之后“有效”。