【发布时间】:2017-03-10 05:22:04
【问题描述】:
我正在使用 Visual Studio 2013。我在 github 中找到了一个项目,该项目正在使用 Visual Studio 2015。我正在尝试编译它,但使用 vs2013 时出现错误
无效的令牌';'在类、结构或接口成员声明中
这里的代码:
private readonly Log _log;
public Log Log => _log; // What => Operator is doing ? Pointer ?
是的,C# [6.0] 中的=> 运算符有哪些新功能?有没有办法在 vs2013 中使用 C# 6.0?
【问题讨论】:
-
不,升级你的VS版本。
-
C# 6.0 是在 VS 2015 中引入的。在 VS 2013 中无法使用它。github.com/dotnet/roslyn/wiki/…
-
或者换成
public Log Log { get; private set; }。 -
c# 6 已随 Visual Studio 2015 引入,因此您只能在 VS 15 或更高版本中使用正文表达式
标签: c#