1. Stack: Stack, advanced out, one assignment, one value, in order.
. Count takes the number of elements in the collection
The. push () pushes the element one by one into the collection using the//stack collection. Push ()
Pop () pops a collection of elements
. Clear () empties the collection
Stack s = new stack (),///First deposit after removing s.push (1); S.push (2); S.push (3); Console.WriteLine (S.pop ()); Also available in a foreach Loop output Console.WriteLine (S.pop ());
2.queue: First deposit the first output, one of the assignment of a value, in order.
. Count takes the number of elements in the collection
. Enqueue () into the Queue collection//Deposit element
. Dequeue () Out queue collection
. Clear to empty the collection
Queue q = new Queue (); Q.enqueue (1); Q.enqueue (2); Q.enqueue (3); Console.WriteLine (Q.dequeue ()); Console.WriteLine (Q.dequeue ());
3.hashtable: Advanced After, one assignment, but only together to take value.
. Add (,) adds key and element//For element addition
. Remove () Removes the element inside the parentheses
. Contains () Determine whether there are bracketed elements in the collection
. Count counts the number of elements in the collection
Hashtable h = new Hashtable (); H.add (1, "SS"); H.add (2, "DD"); foreach (int i in H.keys)//Output key { Console.WriteLine (i); } Console.WriteLine ("------"); foreach (string s in h.values)//output key corresponding to the value { Console.WriteLine (s); } Console.WriteLine ("-----------"); Console.WriteLine (h.count);//Enter the number of elements
15-07-10 stack collection, Queue collection, Hashtable collection