ArrayList of Hashtables in C# -


itemprop = "text">

I have to place an ArrayList where it contains hashtables. I have a hashtable and add value I then added it to ArrayList. Changed the values ​​and added it to the array list again. It does not save the first values ​​and eliminates the repeated value, which were similar to the last values!

Any suggestions? Here is my code

  NamesValueState {Internal class class 1 {public static ArrayList StartList = new array list (); Public stable hashtable start = new hashtable (); Static zero main (string [] args) {start ["active"] = true; ["Name"] = "prog1" start; Start ["Path"] = @ "C: \ Program Files \ prog1"; Start ["parameter"] = string Empty; StartList.Add (start); Start ["active"] = false; ["Name"] = "start 2"; Start ["Path"] = @ "C: \ Program Files \ prog2"; Start ["Parameter"] = "/ q"; StartList.Add (start); (HT ["active"] + "-" HT ["name"] + "-" HT ["path"] + "-" HT ["parameter"]); // it always returns / / false -prog2 -c: \ programfiles \ prog2-/ q} console. Readline (); Start moving inside your main function, and restart it for another add (and as   list  as used by @LessSeffhall). 

  Fixed list & lt; Hashtable & gt; StartList = new list & lt; Hashtable & gt; (); Static zero main (string [] args) {hashtable start = new hashtable (); ["Active"] = start true; ["Name"] = "prog1" start; Start ["Path"] = @ "C: \ Program Files \ prog1"; Start ["parameter"] = string Empty; StartList.Add (start); Start = new hashtable (); Start ["active"] = false; ["Name"] = "start 2"; Start ["Path"] = @ "C: \ Program Files \ prog2"; Start ["Parameter"] = "/ q"; StartList.Add (start);  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -