1. When an item is added to the ArrayList, the dynamic change is too small. It is the most suitable for storing frequently changed data.
2. HashTable is a set of data (keys and values ).
HashTable ht = new HashTable ();
Ht ["key value"] = saved information;
For example, ht [0] = "abc"; textbox1.text = ht [0]; // textbox1.text equals to "abc"
Alternatively, ht ["id"] = "abc"; textbox1.text = ht [0]; // textbox1.text equals to "abc"
Same as session usage
3. Stack (first-in-first-out) and Queue (first-in-first-out)
Queue q = new Queue ();
Q. Enqueue (0 );
Q. Enqueue (1 );
TextBox1.Text = q. Dequeue (). ToString (); // The value is 0.
Stack ss = new Stack ();
Ss. Push (0 );
Ss. Push (1 );
TextBox1.Text = ss. Pop (). ToString (); // The value is 1.
4. ListDictionary is suitable for storing a small amount of data, generally less than 10 items.
For example:
String s = "abcdefg ";
ListDictionary ls = new ListDictionary ();
Ls. Add ("wei", s );
TextBox1.Text = ls ["wei"]. ToString ();
5. StringColletion and StringDictionary can only store strings
6. In addition, there are NamevalueCollection sortedList and so on.
The usage is similar. You can guess how to use it according to the prompts.
Note:
ListDIctionary and StringColletion, StringDictionary, NamevalueCollection
In System. Collections. Specialized