Question

(using vb.Net 4.0) Say you have an object whose graph is fairly complex - it has properties, arrays and other collections, subclasses with their own properties and collections, etc. I want to fully traverse the entire object graph and find all instances of a particular type T, to then perform a particular operation on these instances. Is there a bulletproof way to perform a full traversal of the object graph? Even with reflection, this seems a difficult task that is prone to error.

I was wondering about binary serialization, since that seems to clone an object, no matter how complicated, in a fairly robust manner. Is there any way to modify that technique, such that instead of serializing it instead returns a list of references to all sub-objects of given type T? But that is just pure speculation, I'm open to any feasible solution.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top