title: How do I specify the object to return from an expression tree method?
body: <p>I'm trying to create a method using an expression tree that returns an object, but I can't figure out how to actually specify the object to return. I've tried reading <a href="http://blogs.msdn.com/b/csharpfaq/archive/2009/09/14/generating-dynamic-methods-with-expression-trees-in-visual-studio-2010.aspx">this</a>, but the return value doesn't actually seem to be specified anywhere.</p>
  
  <p>I've got all the assignments &amp; stuff down, but how do I specify the object to return from a method created using expression trees?</p>
  
  <p>EDIT: these are v4 expression trees, and the method I'm trying to create does something like this:</p>
  
  <pre><code>private object ReadStruct(BinaryReader reader) {
      StructType obj = new StructType();
      obj.Field1 = reader.ReadSomething();
      obj.Field2 = reader.ReadSomething();
      //...more...
      return obj;
  }
  </code></pre>