using System.Linq.Expressions;
public static void Main()
obj.objB.objA = new A(){ Valor = "Valor de A" };
string y = Teste.ObterValorExp(obj, "objB.objA.Valor");
Console.WriteLine("Valor: "+ y);
public static class Teste
public static string ObterValorExp(object obj, string prop)
string[] props = prop.Split('.');
Expression exp = Expression.Property(Expression.Constant(obj), props[0]);
for (int i = 1; i < props.Length; i++)
exp = Expression.Property(exp, props[i]);
return Expression.Lambda<Func<string>>(exp).Compile()();
public string Valor {get;set;}