entens.net The less one forgets, the less one can remember.

Hash tables

I normally use hashtables with square brackets because you can pack data easier than with the .add() method.

  1. Hashtable items= new Hashtable();
  2.  
  3. items["item1"] = 87;
  4. items["item2"] = "a string";
  5. items["item3"] = 64;
  6. items["item4"] = 79;
  7.  
  8. foreach (DictionaryEntry item in items)
  9. {
  10.     listBox1.Items.Add("item key: " + item.Key + " , item value: " + item.Value);
  11. }
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.