you have to use reflection to dynamically read the properties of a class. Or, refer to the below code
foreach (PropertyDescriptor p in TypeDescriptor.GetProperties(myObj))
{
// p.Name gives the name of the property
// p.GetValue(myObj) gives the value of the property
}
No comments:
Post a Comment