Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

get key in dictionary c#

public static string GetKeyFromValue(string valueVar)
{
   foreach (string keyVar in dictionaryVar.Keys) 
   { 
      if (dictionaryVar[keyVar] == valueVar)
      {
         return keyVar;
      }
   }
   return null;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #key #dictionary
ADD COMMENT
Topic
Name
7+5 =