Chaitanya

Chaitanya

  • NA
  • 58
  • 55.7k

Loop or equivalent method to iterate through dictionary

Aug 22 2011 10:53 AM
I would like to search for the name that was paired up with the number in dictionary.

This is my code

Dictionary<string, long> d = new Dictionary<string, long>();
d.Add("Xyz", 1234567890);
d.Add("ABC", 123456780);
d.Add("DEF", 9999999999);
if (d.ContainsValue(no))
{
Here i would like to get the name of the corresponding number
}

In this i will get the no from the user text box where i should i compare that no with the dictionary available ad has to produce the name if the pair exists.

Any idea please i am using 2.0 Framework

Answers (2)