VS2013 C#功能声明=>标志

时间:2017-05-16 23:16:35

标签: c# function visual-studio-2013 declaration

此代码在vs2013中给出了错误... 我现在不知道为什么......有人可以帮助我吗? 我的问题是我不知道#blacksection的含义以及如何解决错误

=>

1 个答案:

答案 0 :(得分:6)

在这种情况下,=>表示表达身体成员,相当于:

public static void Fatal(this ILogger l, Func<string> msgFactory) 
{ 
    return FilteredLog(l, LogLevel.Fatal, null, msgFactory); 
}

但是,这种语法是在C#6中引入的,它需要Visual Studio 2015编译器或更新版本。切换到方法语法或升级您的Visual Studio版本。