Horje
get key value from object c# Code Example
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
}
access object property C#
System.Reflection.PropertyInfo prop = typeof(YourType).GetProperty("PropertyName");

object value = prop.GetValue(yourInstance);
...
prop.SetValue(yourInstance, "value");
get key in dictionary c#
public static void Main()
{
    Dictionary<string, string> dict = new Dictionary<string, string>()
    {
        {"1", "one"},
        {"2", "two"},
        {"3", "three"}
    };

    string key = KeyByValue(dict, "two");       
    Console.WriteLine("Key: " + key);
}




Csharp

Related
table fixed header Code Example table fixed header Code Example
get property value from object c# Code Example get property value from object c# Code Example
C# decimal with two places store as string with two places Code Example C# decimal with two places store as string with two places Code Example
unity quit in edtor Code Example unity quit in edtor Code Example
C# type cast float to string Code Example C# type cast float to string Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11