I have a class tree that contains several objects in a hierarchy. Therefore, I can have a Container object that hosts 3 SubContainer objects, which, in turn, place an arbitrary number of Item objects.
Is there a way I can use an XPath style expression over this tree of objects, which would imply a reflection so that I can request a class property with an XPath type expression so that the code looks something like:
object o = Container.Query("/Container/SubContainer[1]/Item[1]/@ItemProperty");
The XPath syntax is obviously fully compiled and probably invalid, but it just illustrates to give you an idea of what I'm looking for.
Edit -> The reason I would like to query in this way is that the path to the object is not fixed and therefore must be configured by the application user.
Thanks.
source
share