C# Dictionary通过Value找Key

Dictionary<string, string> ActiveName = new Dictionary<string, string>();
for(int i=0;i<10;i++)
{
     
  ActiveName.Add("","");
}
string a="";
int indexSARFKSCIActive = ActiveName.Values.ToList().IndexOf(strValue);
if (indexSARFKSCIActive >= 0)
{
     
   a = ActiveName.Keys.ToList()[indexSARFKSCIActive];
}

你可能感兴趣的:(C# Dictionary通过Value找Key)