what is dictionary? How to use

 Posted by deccansoft on 9/27/2010 | Category: C# Interview questions | Views: 1081

Dictionary<K,V> is a generic collection that contains data in Key/Value pairs, it
is just like the nongeneric collection Hashtable.
Ex:-Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("Key", "Value"); //Add the specified key and value to the
// dictionary
dictionary.Remove("Key"); //Removes the value with the specified
// key from the dictionary
int count = dictionary.Count; //get the number of the Key/Value pairs
// contained in the dictionary

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response