Answers for "how to get value from dictionary with key c#"

C#
1

get key value from object c#

Type myType = myObject.GetType();
IList<PropertyInfo> props = new List<PropertyInfo>(myType.GetProperties());

foreach (PropertyInfo prop in props)
{
    object propValue = prop.GetValue(myObject, null);

    // Do something with propValue
}
Posted by: Guest on January-06-2021
-1

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;
}
Posted by: Guest on November-05-2021

Code answers related to "how to get value from dictionary with key c#"

C# Answers by Framework

Browse Popular Code Answers by Language