【发布时间】:2015-12-21 16:22:50
【问题描述】:
我被告知 Visual Studio 2012 将不支持 C# 6.0,并且要编译 C# 6.0 代码,我需要升级到较新版本的 Visual Studio。
但是,当我粘贴 C# 6.0 代码时,Resharper 会询问我是否要启用 C# 6.0 支持。如果允许,我可以编译 C# 6.0 代码。
List<string> customers = null;
string Customer;
int? length = customers?.Count;
Customer = customers?[0];
它似乎工作,但谁能解释它是如何工作的?
如果我进入项目的属性/构建/高级...“语言版本”设置为“默认”。如果我检查下拉列表,我最多只能看到 C# 5.0。
【问题讨论】:
-
据我记得它不能为自动属性分配默认值。也试试,也许他们修好了:)
标签: c# visual-studio-2012 resharper