C# get property from object by string code example
Example 1: c# get property using string
public static object GetPropValue(object src, string propName)
{
return src.GetType().GetProperty(propName).GetValue(src, null);
}
Example 2: c# get object property value by name
return car.GetType().GetProperty(propertyName).GetValue(car, null);