What is the best way to go about this in C#?
string propPath = "ShippingInfo.Address.Street";
I’ll have a property path like the one above read from a mapping file.
I need to be able to ask the Order object what the value of the code below will be.
this.ShippingInfo.Address.Street
Balancing performance with elegance. All object graph relationships should be one-to-one.
Part 2: how hard would it be to add in the capability for it to grab the first one if its a List<> or something like it.
Perhaps something like this?
Or, if you prefer LINQ, you could try this instead. (Although I personally prefer the non-LINQ version.)