Mimic property/list changes on an object on another object
- by soundslike
I need to mimic changes (property/list) changes on an object and then apply it to another object to keep the structure/property the same.
In essence it's like cloning etc. the biz rules require certain properties to not be applied to the other object, so I can't just clone the object otherwise this would be easy.
I've already walked the source object to get INotifyPropertyChanged and IListChanged events, so I have the "source" and the args (Property or List) changed event notifications.
Given that I guess I could build a reflection "hierarchy path" starting from the top level of the source object to get to the Property or List changed "source" (which could be several levels deep).
Ignoring for the moment that certain object properties should not propagate to the other object, what's a way to build this "path"? Is a brute force top level down to build the "path" (and discard on the way back up if we don't hit the original changed event "source") the only way to do it?
Any clever ideas on how to mimic changes from one object to another object?