I have code that would recursively parse an unknown object structure. But I want to be able to change values of the member objects of the parent object. How can I do this with this code?
void CompareObjects(ref object currentObject)
{
Type currentType = currentObject.GetType();
PropertyInfo[] properties = currentType.GetProperties();
foreach (PropertyInfo property in properties)
{
object current_object = currentType.GetProperty(property.Name).GetValue(currentObject));
CompareObjects(ref current_object);
}
}
Aucun commentaire:
Enregistrer un commentaire