I want to get a property value at runtime but the following code is production
"System.Reflection.TargetException Object does not match target type"
Type t = obj.GetType()// obj is the object whose property is required
PropertyInfo pi = t.GetProperties();
foreach (PropertyInfo prop in pi)
string sName = prop.Name;
Type t1 = prop.PropertyType;
object o = prop.GetValue(prop.PropertyType,null);
am I doing somethng wrong?