相关疑难解决方法(0)

按值获取字典键

如何在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?

c# dictionary

336
推荐指数
4
解决办法
49万
查看次数

标签 统计

c# ×1

dictionary ×1