如何将 C# 6.0 添加到 Visual Studio 2013? [英] How can I add C# 6.0 to Visual Studio 2013?

查看:27
本文介绍了如何将 C# 6.0 添加到 Visual Studio 2013?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以将 C# 6.0 添加到 Visual Studio 2013 中?如果我不能,那是为什么?

Is there any way to add C# 6.0 to Visual Studio 2013? If I can't why is that?

推荐答案

目前您可以为 VS2013 做的最好的事情是下载 4 月最终用户预览,现在已经过时了.

The best you can currently do for VS2013 is download the April End User Preview, which is pretty outdated by now.

VS2013 编译器(按原样)不理解"C#-6 功能.大多数(如果不是全部)C# 新功能都是编译器解释并为其发出不同代码的语法糖.为了让 VS2013 支持它,它必须升级编译器以支持这些功能.

The VS2013 compiler (as is) doesn't "understand" C#-6 features. Most, if not all of the C# new features are syntactic sugar which the compiler interprets and emits different code for. In order for VS2013 to support that, it has to upgrade the compiler to support those features.

更不用说 VS2015 将带来一个全新的 CSC,名为 Roslyn

Not to mention VS2015 will bring with it a completely new CSC, named Roslyn

例如,表达式主体属性:

For example, expression body properties:

public override string ToString() => string.Format("{0}, {1}", First, Second);

编译为:

public override string ToString()
{
   return string.Format("{0}, {1}", First, Second);
}

这篇关于如何将 C# 6.0 添加到 Visual Studio 2013?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆