<Textarea style = "display: none"> system. collections. generic. dictionary; // key/value pair set system. collections. generic. keyvaluepair; // key/value pair structure, which exists as an element of the dictionary system. collections. generic. sorteddictionary; // equivalent to automatically sorting dictionarysystem by key. collections. generic. sortedlist; // similar to sorteddictionary, but the internal <SPAN class = 'wp _ keywordlink '> algorithm </span> is different. Its keys and values can access system through indexes. collections. generic. hashset; // unordered, non-repeating element set system. collections. generic. sortedset; // equivalent to the hashsetsystem that can be automatically sorted. collections. generic. list; // equivalent to a generic arraylist. elements can be repeated, sorted, inserted, and indexed to access system. collections. generic. queue; // queue, first-in-first-out system. collections. generic. stack; // stack, first in and out of the system. collections. generic. linkedlist; // two-way linked list system. collections. generic. listnode; // The Node system of the listnode list. collections. generic. synchronizedcollection; // a set of thread-safe systems. collections. generic. synchronizedreadonlycollection; // a thread-safe read-only collection system. collections. generic. synchronizedkeyedcollection; // thread-safe key/value set </textarea>
Dictionary, keyvaluepair:
Protected void button1_click (Object sender, eventargs e) {dictionary <string int> dict = new dictionary <string int> (); dict. add ("K1", 123); dict ["K2"] = 456; dict. add ("K3", 789); string STR = ""; foreach (keyvaluepair <string int> K in dict) {STR + = string. format ("{0}-{1};", K. key, K. value); // K1-123; K2-456; K3-789;} textbox1.text = STR ;}</string> </string>
Sorteddictionary:
Protected void button1_click (Object sender, eventargs e) {sorteddictionary <string int> dict = new sorteddictionary <string int> (); dict. add ("K3", 333); dict ["K1"] = 111; dict. add ("K2", 222); sorteddictionary <string int>. keycollection Ks = dict. keys; sorteddictionary <string int>. valuecollection Vs = dict. values; string S1, S2, S3; S1 = S2 = S3 = ""; foreach (keyvaluepair <string int> K in dict) {S1 + = string. format ("{0}-{1};", K. key, K. value); // K1-111; K2-222; K3-333;} foreach (string s in KS) {S2 + = S + ";" ;}// K1; K2; K3; foreach (int n in VS) {S3 + = n. tostring () + ";" ;}// 111; 222; 333; textbox1.text = S1 + "\ n" + S2 + "\ n" + S3 ;} </string>
Sortedlist:
Protected void button1_click (Object sender, eventargs e) {sortedlist <string int> dict = new sortedlist <string int> (); dict. add ("K3", 333); dict ["K1"] = 111; dict. add ("K2", 222); string S1, S2, S3; S1 = S2 = S3 = ""; foreach (keyvaluepair <string int> K in dict) {S1 + = string. format ("{0}-{1};", K. key, K. value); // K1-111; K2-222; K3-333;} S2 = dict. keys [0]; // K1 S3 = dict. values [0]. tostring (); // 111 textbox1.text = S1 + "\ n" + S2 + "\ n" + S3 ;}</string> </string>
Hashset and sortedset:
Protected void button1_click (Object sender, eventargs e) {hashset <string> HS = new hashset <string> (); HS. add ("CCC"); HS. add ("BBB"); HS. add ("AAA"); sortedset <string> SS = new sortedset <string> (); SS. add ("CCC"); SS. add ("BBB"); SS. add ("AAA"); string S1 = "", S2 = ""; foreach (string s in HS) {S1 + = S + "";} // ccc bbb aaa foreach (string s in SS) {S2 + = S + "" ;}// aaa bbb ccc textbox1.text = S1 + "\ n" + S2 ;} </string>
List:
Protected void button#click (Object sender, eventargs e) {list <int> List = new list <int> (); list. add (11); list. add (22); list. insert (0, 33); string S1, S2 = "", S3, S4 = ""; S1 = list [0]. tostring (); // 33 for (INT I = 0; I </int>
Listlist and listnode:
Protected void button#click (Object sender, eventargs e) {parameter list <string> List = new parameter list <string> (); list. addfirst ("AAA"); list. addlast ("BBB"); list. addfirst ("CCC"); list. addafter (list. first, "DDD"); list. addbefore (list. last, "eee"); string S1 = "", S2 = "", S3 = "", S4 = "", S5 = ""; foreach (string s in List) {S1 + = S + "" ;}// ccc ddd aaa eee bbb complete listnode <string> node = List. fir St; S2 = node. value. tostring (); // CCC node = node. next; S3 = node. value. tostring (); // DDD node = List. last. previous. previous; S4 = node. value. tostring (); // AAA list. remove ("eee"); list. removefirst (); list. removelast (); node = List. first; while (node! = NULL) {S5 + = node. value. tostring () + ""; // ddd aaa node = node. next;} textbox1.text = S1 + "\ n" + S2 + "\ n" + S3 + "\ n" + S4 + "\ n" + S5 ;} </string>