如何在C#中按值获取Dictionary键?
Dictionary<string, string> types = new Dictionary<string, string>()
{
{"1", "one"},
{"2", "two"},
{"3", "three"}
};
Run Code Online (Sandbox Code Playgroud)
我想要这样的东西:
getByValueKey(string value);
Run Code Online (Sandbox Code Playgroud)
getByValueKey("one")必须回来"1".
这样做的最佳方式是什么?也许是HashTable,SortedLists?