Stringdictionary is equivalent to a hash table where both the key and value are strings.
Main members:
/* Attribute */count; // keys; // key set values; // value set/* Method */Add (); // clear (); // containskey (); // whether it contains the specified key containsvalue (); // whether it contains the specified value copyto (); // assign the specified value to the array remove (); // Delete by key
Simple exercises:
Protected void button1_click (Object sender, eventargs e) {stringdictionary SD = new stringdictionary (); SD. add ("K1", "AAA"); SD. add ("K2", "BBB"); SD. add ("K3", "CCC"); SD ["K2"] = "BBB"; string STR = ""; foreach (dictionaryentry de in SD) // system. collections. dictionaryentry {STR + = string. format ("{0 }:{ 1};", de. key, de. value);} textbox1.text = STR; // K1: AAA; K2: BBB; K3: CCC;} protected void button2_click (Object sender, eventargs E) {stringdictionary SD = new stringdictionary (); SD. add ("K1", "AAA"); SD. add ("K2", "BBB"); SD. add ("K3", "CCC"); string str1, str2; str1 = str2 = ""; foreach (string s in SD. keys) {str1 + = S + ",";} // K1, K2, K3, foreach (string s in SD. values) {str2 + = S + "," ;}// AAA, BBB, CCC, textbox1.text = str1 + "\ n" + str2 ;}