C # hash table & Queue & Stack

Source: Internet
Author: User

Hash table:
Does not specify the type, does not specify the length, does not specify the key value
Hashtable ht = new Hashtable (); Defined
HT[1] = 1;
Ht[' a '] = "abc";
ht["AB"] = ' a ';
HT[3.14] = 1.14;
Ht.  ADD (2, "qwerty"); adding elements
Ht.  Remove (' a '); Delete Element
foreach (Var x in HT. Values)
{
Console.WriteLine (x);
}//Traversal, because the type cannot be determined using the universal var type

Queue:
Advanced First Out
Not specified length, not specified type
Queue line = new Queue (); Defined
Line.  Enqueue ("AAA"); Add to
Line. Enqueue (12345555555);
Line. Enqueue (' a ');
Console.WriteLine (line.  Dequeue ()); Output, FIFO
Console.WriteLine (line.  Count); Record the number of key values
foreach (var x in line)
{
Console.WriteLine (x);
}//Traverse the same

Stack:
Advanced Post-out
Specified type, not specified length
stack<int> stack = new stack<int> (); Defined
Stack.  Push (183); Add to
Stack. Push (255);
Console.WriteLine (Stack.  Pop ()); Output, LIFO
Console.WriteLine (Stack.  Count); Record the number of key values
Traverse
....

Console.read ();

C # hash table & Queue & Stack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.