I went to an interview recently and there they asked me the following question:
Write a component to travel through an object hierarchy based on the data path passed in and return the value of the property implemeting the following method:
Public object getValueFromPath(object parentObj, string dataPath);
The object hierarchy will be some thing like this:
Object1
objectRef2
property1
property2
parentObj will be Object1
dataPath will be objectRef2.property2
Can some one give me an idea how I can do that.