Asp. NET dictionary Basic Usage Example Analysis _ practical skills

Source: Internet
Author: User

This example describes the basic usage of dictionary in asp.net. Share to everyone for your reference, specific as follows:

Dictionary is located under the System.Collections.Generic namespace/* System.Collections.Generic namespace must be referenced before using dictionary; * The data type (which can be any type) whose key and value must be declared when using Dictionary;///Declaration instantiation Dictionary as DiC system.collections.generic.dictionary<int, string
> dic = new system.collections.generic.dictionary<int, string> (); Add key and value dic to DIC.
Add (, "quber100"); Dic.
ADD ("quber200"); Check for the existence of the 300 key if (!dic). ContainsKey (300)) {//new addition of 300 (key) and corresponding quber300 (value) dic.
ADD ("quber300"); //Remove DIC with dic key of 300.
Remove (300); Get DIC key value pairs total int diccount = dic.
Count;
Response.Write ("Cyclic acquisition of key and value:<br/> in dic"); Iterates through the keys and values of DIC (Keyvaluepair<int, string> keydic in dic) {Response.Write ("key: + Keydic.key +", Value: "
+ Keydic.value + "<br/>");
} Response.Write (" 

More interested readers of asp.net related content can view the site topics: "asp.net operation JSON tips summary", "asp.net string operation tips Summary", "ASP.net Operation XML Skills summary", "asp.net file Operation skills Summary", " asp.net Ajax Skills Summary topic and the "ASP.net cache operation skills Summary."

I hope this article will help you to ASP.net program design.

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.