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
New Stack (); // first deposit and then take out S.push (1); S.push (2); S.push (3); // also available with 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 =NewHashtable (); H.add (1,"SS"); H.add (2,"DD"); foreach(intIinchH.keys)//Output Key{Console.WriteLine (i); } Console.WriteLine ("------"); foreach(stringSinchH.values)//the value that corresponds to the output key{Console.WriteLine (s); } Console.WriteLine ("-----------"); Console.WriteLine (h.count);//Enter the number of elements altogether
Stack collection, Queue collection, Hashtable collection