如何在Visual Studio 2015中使用C#7?

编程入门 行业动态 更新时间:2024-10-22 04:53:56
本文介绍了如何在Visual Studio 2015中使用C#7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Visual Studio 2017(15.x)支持C#7,但是Visual Studio 2015 (14.x)呢?

Visual Studio 2017 (15.x) supports C# 7, but what about Visual Studio 2015 (14.x)?

如何将C#7与之配合使用?

How can I use C# 7 with it?

推荐答案

您可以通过安装Nuget软件包 Microsoft.Net.Compilers :

You can replace the compiler shipped with Visual Studio for a C# 7-enabled version by installing the Nuget package Microsoft.Net.Compilers:

引用此软件包将导致使用 C#和Visual Basic编译器中包含的特定版本 软件包,而不是任何系统安装的版本.

Referencing this package will cause the project to be built using the specific version of the C# and Visual Basic compilers contained in the package, as opposed to any system installed version.

没有迹象表明我可以在软件包页面上看到Visual Studio 2015是否正式支持此功能.到目前为止,我的不严格测试表明它可以正常运行,但并非不费吹灰之力-C#7代码可以编译,但是带有下划线红色的波浪线表示语法错误: 请注意,您还需要安装Nuget软件包 System.ValueTuple 使用新的C#7值元组功能.

There is no indication that I can see on the package page as to whether this is officially supported in Visual Studio 2015. My not-thorough tests so far indicate that it works but not painlessly - C# 7 code compiles, but is underlined with the red squiggly line which indicates a syntax error: Note that you will also need to install the Nuget package System.ValueTuple to use the new C# 7 value tuples features.

更多推荐

如何在Visual Studio 2015中使用C#7?

本文发布于:2023-11-03 15:41:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555471.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!