我已经安装了Visual Studio 15 Preview 3,并尝试使用新的元组功能
static void Main(string[] args) { var x = DoSomething(); Console.WriteLine(x.x); } static (int x, int y) DoSomething() { return (1, 2); }
当我编译我得到错误
Predefined type 'System.ValueTuple´2´ is not defined or imported
根据the blog post,这个功能默认为“开”。
我做错了什么?
如果要定位到.NET 4.6.1或更低版本或.NET Core,则需要安装NuGet软件包System.ValueTuple:
Install-Package “System.ValueTuple”