I have a nested set of objects, i.e. some properties are custom objects. I would like to get the value of a property of an object in a hierarchy group using a string for the name of the property, and some form of the “find” method to scan the hierarchy to find the property with the corresponding name and get its value.
Is this possible, and if so, how?
Many thanks.
EDIT
The class definition may be in pseudocode:
Class Car
Public Window myWindow()
Public Door myDoor()
Class Window
Public Shape()
Class Door
Public Material()
Car myCar = new Car()
myCar.myWindow.Shape ="Round"
myDoor.Material = "Metal"
Everything is a little far-fetched, but can I "find" the value of the "Shape" property using the "Shape" magic string in some form of search function, starting from the top object. i.e:
string myResult = myCar.FindPropertyValue("Shape")
I hope myResult = "Round".
, .
.