get dictionary key by value

Posted by loviji on Stack Overflow See other posts from Stack Overflow or by loviji
Published on 2010-03-14T22:23:34Z Indexed on 2010/03/14 22:35 UTC
Read the original article Hit count: 205

Filed under:
|

how to get a Dictionary key by value in C#?

Dictionary<string, string> types = new Dictionary<string, string>()
{
            {"1", "one"},
            {"2", "two"},
            {"3", "three"}
};

I want simething like this:

getByValueKey(string value);

getByValueKey("one") must be return "1".

What is the best way do this? may be HashTable, SortedLists?

© Stack Overflow or respective owner

Related posts about c#

Related posts about dictionary