📜  获取字典中的键 c# 代码示例

📅  最后修改于: 2022-03-11 14:49:13.594000             🧑  作者: Mango

代码示例3
public static string GetKeyFromValue(string valueVar)
{
   foreach (string keyVar in dictionaryVar.Keys) 
   { 
      if (dictionaryVar[keyVar] == valueVar)
      {
         return keyVar;
      }
   }
   return null;
}