For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Wednesday, September 03, 2014

Dictionary in C#

Dictionary in C#

Dictionary is faster that ArrayList and HashTable in C#, here is the example that how to use Dictionary in C#.



Dictionary<int, string> dict = new Dictionary<int, string>();
//You are free to use either :
//Dictionary<string,int> dict = new Dictionary<string,int>();
dict.Add(1, "AA");
dict.Add(2, "BB");
dict.Add(3, "CC");

foreach (var data in dict) {
      nmCode = data.Key.ToString();
      nm = data.Value.ToString();
}



Share:

0 comments:

Post a Comment

Add Dependent Scripts

   here is the code that allow to add dependent script :         <script>         const addDependentScripts = async function( scriptsT...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive