title: how to create expression tree / lambda for a deep property from a string
body: <p>Given a string: "Person.Address.Postcode" I want to be able to get/set this postcode property on an instance of Person. How can I do this? My idea was to split the string by "." and then iterate over the parts, looking for the property on the previous type, then build up an expression tree that would look something like (apologies for the pseudo syntax):</p>
  
  <pre><code>(person =&gt; person.Address) address =&gt; address.Postcode
  </code></pre>
  
  <p>I'm having real trouble acutally creating the expression tree though! If this is the best way, can someone suggest how to go about it, or is there an easier alternative?</p>
  
  <p>Thanks</p>
  
  <p>Andrew</p>
  
  <pre><code>public class Person
  {
      public int Age { get; set; }
      public string Name { get; set; }
      public Address Address{ get; set; }
  
      public Person()
      {
          Address = new Address();
      }
  }
  
  public class Address 
  {
      public string Postcode { get; set; }
  }
  </code></pre>