Stack advanced out without index stack st = new stack (); St. Push (n); St. Push (one); St. Push (+); St. Push (a); St. Push (56);//Insert 56 from the top of the stack should be at the upper Console.WriteLine of the Stack (St. Peek ());//st. Peek (); Returns the top data of the stack without removing the Console.WriteLine (St. Pop ());//st. Pop (); Remove and return the top data value of the stack object[] arr1 = (object[]) St. ToArray ();//You can convert an array value from the top to the bottom of the foreach (int i in arr1) { Console.Write (i + "");//traverse to one of the }
console.readline ();
Queue FIFO queue qu = new queue (); Qu. Enqueue (12);//Add Data 12 should be qu at the beginning of the queue . Enqueue (); Qu. Enqueue (+); Qu. Enqueue (+); Console.WriteLine (Qu. Peek ());//qu. Peek (); Returns the object at the beginning without removing the Console.WriteLine (qu. Dequeue ());//qu. Dequeue (); Returns the object at the beginning but removes the object[] arr2 = (object[]) qu. ToArray (); Convert an array value from the queue to the start of the foreach (int i in arr2) { Console.Write (i + "");//traverse result is the " console.read" Line ();
Hashtable reads an array with key-value pairs, and can set its own index Hashtable ht = new Hashtable (); Ht. ADD (1, "Tiger");//any type of key key any type of value ht. ADD (2, "lion"); Ht. ADD (3, "monkey");
Retrieving the--stack stack queue hashtable hash table