相关疑难解决方法(0)

未定义或导入预定义类型'System.ValueTuple'2'

我安装了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);
}
Run Code Online (Sandbox Code Playgroud)

当我编译时,我收到错误:

未定义或导入预定义类型'System.ValueTuple'2'

根据博客文章,这个功能默认情况下应该"打开".

我做错了什么?

c# c#-7.0 visual-studio-2017

362
推荐指数
4
解决办法
9万
查看次数

如何将数组转换为字典

如何将fieldList数组转换为字典为Dictionary<string,column> (i.e. Dictionary of name property of column class as key and value property of dictionary as column object).

public class columninfo
{
 public string name {get;set;}
 public column[] fieldList {get;set;}
}

public class column
{
  public string name {get;set;}
  public string fieldname {get;set}
  public string format {get;set;}
}
Run Code Online (Sandbox Code Playgroud)

c# linq dictionary c#-6.0

1
推荐指数
1
解决办法
2037
查看次数

标签 统计

c# ×2

c#-6.0 ×1

c#-7.0 ×1

dictionary ×1

linq ×1

visual-studio-2017 ×1