title: How to Save an Expression Tree as the Main Entry Point to a New Executable Disk File?
body: <p>I'm trying to export an expression tree to a PE assembly as the main entry point.  I've acquired a Lambda Expression through building an expression tree, for example:  </p>
  
  <pre><code>using System.Linq;
  using System;
  
  // 1. use expression trees to create a block expression (not shown)
  
  // 2. create a lambda expression: 
  LambdaExpression exprLambda = Expression.Lambda(exprBlock, new ParameterExpression[0]);
  
  MethodBuilder mbuilder = null;
  // 3. ??? Somehow get a method builder instance that works ??? 
  
  // 4. Compile the lambda using the MethodBuilder instance. 
  exprLambda.CompileToMethod(mbuilder);
  
  // 5. ??? Somehow get an AssemblyBuilder instance to .Save(..) this to disk.  ??? 
  </code></pre>
  
  <p>Steps 3 and 5 are what I'm missing. </p>