winforms - Working with a List of Lists as a Class in C# -


i created following class organize variables need save text file:

public class listofvariablestosave : list<list<tuple<string, int, string>>> {     public list<tuple<string, int, string>> control { get; set;}     public list<tuple<string, int, string>> interaction { get; set;}      public listofvariablestosave()     {         control = new list<tuple<string, int, string>>         {             tuple.create("/yd/ydc/mcstep", 0, ""),             tuple.create("/yd/ydc/ncstep", 0, ""),             tuple.create("/yd/ydc/dcstec", 0, ""),             tuple.create("/yd/ydc/dctime", 0, ""),             tuple.create("/yd/ydc/icoutf", 0, ""),             tuple.create("/yd/ydc/icshtf", 0, "")         };          interaction = new list<tuple<string, int, string>>         {             tuple.create("/yd/ydi/micoup", 0, ""),             tuple.create("/yd/ydi/nicoup", 0, ""),             tuple.create("/yd/ydi/diezon", 0, ""),             tuple.create("/yd/ydi/i1iecn", 1, ""),             tuple.create("/yd/ydi/i1iect", 1, ""),             tuple.create("/yd/ydi/mistate", 0, "")         };     } } 

however, when create instance with:

listofvariablestosave mylistofvariablestosave =      new listofvariablestosave(); 

i list no elements (count = 0).in particular, when try access list following code:

foreach (list<tuple<string, int, string>> db in mylistofvariablestosave) {     foreach (tuple<string, int, string> vartosave in db)     {         // something.     } } 

nothing happens because (outer) list empty. missing? how access lists inside outer list?

this because inherited list, did not put in constructor. if 2 items created become available, add these 2 lines end of constructor:

add(control); add(interaction); 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -