gpt4 book ai didi

c# - 在 Visual Studio 2017 中的 'web site' 中设置 C# 7

转载 作者:太空宇宙 更新时间:2023-11-03 15:05:05 24 4
gpt4 key购买 nike

我在 Visual Studio 2017 中创建了一个新的“网站”。

我正在尝试使用新的元组语法 - 我将其直接输入到后面的代码中:

private (string a, string b) myfunc()
{

}

它说你不能在 C# 5 中使用新的元组语法。我将此应用程序设置为 .net Framework 4.7

是否可以将网站应用设置为 C# 7?这适用于新的 MVC 应用程序,但不适用于网站。

我在 Google 中找不到设置 C# 版本的明确方法。似乎很奇怪,这不容易设置?!

是否可以在网站项目中使用元组/C# 7?

最佳答案

C# 7 默认不包含元组。您需要安装 System.ValueTuple nuget .

请看自this blog :

First things first, if you create a new Visual Studio 2017 Console App in .NET Core to try tuples in C# 7, one must first add System.ValueTuple from Nuget to experience the new enhancements.

关于c# - 在 Visual Studio 2017 中的 'web site' 中设置 C# 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43989051/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com