誰能幫助下面的列表元組超過8個元素是不工作:列表元組超過800項
List<Tuple<int, string, double, string, int, string, double, Tuple<int, string>>> tpl = new
List<Tuple<int, string, double, string, int, string, double, Tuple<int, string>>>();
tpl.Add(Tuple.Create(1, "ABC", 100.123, "XYZ", 1, "ABC", 100.123, new Tuple<int, string>(100, "My Rest Item")));
foreach(var k in tpl)
listBox1.Items.Add(k.Item1.ToString() + " ---> " + k.Item2.ToString() + " ---> " + k.Item3.ToString() + " ---> " +
k.Item4.ToString() + " ---> " + k.Item5.ToString() + " ---> " + k.Item6.ToString() + " ---> " +
k.Item7.ToString() + " ---> " + k.Rest.Item1.ToString());
它提供了以下錯誤
錯誤1 的最佳重載的方法匹配'
System.Collections.Generic.List<System.Tuple<int,string,double,string,int,string,double,System.Tuple<int,string>>>.Add(System.Tuple<int,string,double,string,int,string,double,System.Tuple<int,string>>)
' 有一些無效參數C:\ Users \ Hewlett Packard \ AppData \ Local \ Temporary Projects \ WindowsFormsApplication1 \ Form1.cs 68 17 WindowsFormsApplication1 and Er ROR 2參數1:不能從 'System.Tuple<int,string,double,string,int,string,double,System.Tuple<System.Tuple<int,string>>>
' 到 'System.Tuple<int,string,double,string,int,string,double,System.Tuple<int,string>>
' 轉換C:\用戶\惠普 惠普\應用程序數據\本地\臨時 項目\ WindowsFormsApplication1 \ Form1.cs中68 25 WindowsFormsApplication1
除了 - 不要這樣做!用相關屬性等創建你自己的命名類型。 –