2
Answers

Loop or equivalent method to iterate through dictionary

Chaitanya

Chaitanya

13y
3.4k
1
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)