我安装了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'
根据博客文章,这个功能默认情况下应该"打开".
我做错了什么?
如何将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)