I've been told that C# 6.0 is not going to be supported by Visual Studio 2012 and that to compile C# 6.0 code, I would need to upgrade to a newer version of Visual Studio.
However, when I paste in C# 6.0 code, Resharper asks me if I would like to enable C# 6.0 support. If I allow it, I'm able to compile C# 6.0 code.
List<string> customers = null;
string Customer;
int? length = customers?.Count;
Customer = customers?[0];
It seems to work, but can anyone explain how it's working?
If I go into the project's properties / Build / Advanced... the 'Language version' is set to 'default'. And if I check the dropdown, I can only see up to C# 5.0.
根据此答案 ,如果您在项目中安装了“ Microsoft.Net.Compilers” NuGet软件包,则它可以在VS 2012中工作。
我最好的猜测是您正在使用ReSharper Build Engine(ReSharper->选项->工具-> Build,请参阅Build Engine)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.