Before I don't have today's research, I always thought that only arraylist and havehtable in the Collection class were useful. After today, I watched the book later, I have a deeper understanding of the Collection class. The following code will be inserted by VB and C #. Because I c # and vb will, because some function C # functions are not very good, VB is used.
1: When the collection of Collection is of course an array. . The definition method of array is:
int [] int_Array = new int [10]
int [] MyintArray = new int [5] {1, 2, 3, 4, 5}; above, I don't explain.
2: The use of structures in the array, the code is as follows:
Create a class:
Class test {public string str_name; public string str_phone;} References to this class:
TEST [] mytest = new test [3]; for (int i = 0; i 3: arraylist ArrayList, I don't say much, anyway, his biggest feature is sorting. 4: Hashtable The disadvantage of HashTable is not to support sorting. Unfortunately, I am very troublesome to take Value according to Key in C #. 5: sortedlist The use of sortedlist and the use of ArrayList are similar, just SortedList automatically sort. 6: Stack Dim St AS New St.Push ("aa") st.push ("bb") Stack is a confrontation, according to the principle of advanced 7: Queue Dim myQue as new system.collections.queue myque.enqueue ("aa") Queue has just contrary to Stack, Queue is the principle of advanced first. 8: Specialized There are many strengths below in Specialized, and you can use it. 9: Enumerate VB and C # example: VB: DIM IE as system.collections.ienumerator = al.keys.getenuerator Dim Str As string = "" "While (ie.movenext) STR = IE.current End While C #: System.collections.ienumerator ie = sl.keys.geteNumerator (); string str = ""; while (ie.movenext ()) {str = ie.current.toString ();