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.