c#7元组.无法在mac dotnet核心1.1中使用元组

Jac*_*man 7 c# .net-core visual-studio-code c#-7.0

我正在尝试在macOS中实现Visual Studio Code中的元组c#7新功能.

   using System;
   using System.Collections.Generic;

   namespace newcsharp
   {
    public class Program
    {
        public static void Main(string[] args)
        {
            int[] numbers = { 1, 3, 4, 10, 6, 20, 78, 15, 6 };
            var result = Range(numbers);
            Console.ReadLine();
        }

        private static (int Max, int Min) Range(IEnumerable<int> numbers)
        {
            int min = int.MaxValue;
            int max = int.MinValue;
            foreach (var n in numbers)
            {
                min = (n < min) ? n : min;
                max = (n > max) ? n : max;
            }
            return (max, min);
        }
      }
   }
Run Code Online (Sandbox Code Playgroud)

我得到以下错误. 在此输入图像描述

我包含了System.ValueTuple包,用于在我的项目中使用元组功能.

我的project.json

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.1.0"
    },
    "System.ValueTuple": "4.3.0"
  },
  "frameworks": {
    "netcoreapp1.1": {
      "imports": "dnxcore50"
    }
  },
  "tooling": {
    "defaultNamespace": "newcsharp"
  }
}
Run Code Online (Sandbox Code Playgroud)

任何帮助赞赏.

Tho*_*mas 2

C# 7 的编译器尚未发布。在您的项目和问题中,没有迹象表明您正在使用它的 RC 版本。ValueTuple 只是编译器的类型支持。

等到 VS2017 的发布(2017 年 3 月 7 日)...它应该包含 C# 7,并且在同一时间范围内将会有一个 .NET Core 版本,很可能包含新的编译器。