Answers for "c# reflection get value of property by name"

C#
2

c# get object property value by name

return car.GetType().GetProperty(propertyName).GetValue(car, null);
Posted by: Guest on April-24-2020
1

get property 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

Code answers related to "c# reflection get value of property by name"

C# Answers by Framework

Browse Popular Code Answers by Language