我如何通過值在C#中的字典鍵?
Dictionary<string, string> types = new Dictionary<string, string>()
{
{"1", "one"},
{"2", "two"},
{"3", "three"}
};
我想是這樣的:
getByValueKey(string value);
getByValueKey("one")
必須返回"1"
。
這樣做的最佳方法是什麼?也許HashTable,SortedLists?
精確重複:http://stackoverflow.com/questions/255341/ – Gabe 2010-03-14 22:29:03
我以前閱讀過這篇文章,但回答到達那裏。 – loviji 2010-03-14 22:38:27
是的,但是你得到了[Skeet公認的答案](http://stackoverflow.com/a/255638/1028230)。 – ruffin 2014-01-20 22:33:42