How do I build an expression that will fulfill the following goal:
public object Eval(object rootObj, string propertyString)
eg: Eval(person, "Address.ZipCode") => return person.Address.ZipCode
Expression.PropertyOrField doesn't work because I don't have the type of each intermediate property. I'd like to avoid creating a dependency on a scripting library.
I want to try to use expressions because it would allow me to store a cache of these expression trees as they would be executed several times. I'm aware that it's possible to do this iteratively or recursively with reflection.