Liste Tupel mehr als 8 Elemente

Kann mir jemand helfen die folgende Liste Tupel mehr als 8 Elemente funktioniert nicht:

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());

Gibt es folgenden Fehler

Fehler 1 Die beste übereinstimmung für die überladene Methode
'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>>)'
hat einige ungültige Argumente C:\Users\Hewlett
Packard\AppData\Local\Temporary
Projects\WindowsFormsApplication1\Form1.cs 68 17 WindowsFormsApplication1
und Fehler 2 Argument 1: cannot convert from
'System.Tuple<int,string,double,string,int,string,double,System.Tuple<System.Tuple<int,string>>>'
zu
'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 25 WindowsFormsApplication1

  • Abgesehen von allem anderen - tun Sie das nicht! Erstellen Sie Ihre eigenen benannten Typ mit den relevanten Eigenschaften etc.
InformationsquelleAutor user3748422 | 2014-06-17
Schreibe einen Kommentar