title: What does Lambda Expression Compile() method do?
body: <p>I am trying to understand AST in C#. I wonder, what exactly <code>Compile()</code> method from this example does.</p>
  
  <pre><code>// Some code skipped    
  Expression&lt;Func&lt;string, int, int, string&gt;&gt; data = Expression.Lambda&lt;Func&lt;string, int, int, string&gt;&gt;( 
          Expression.Call(s, typeof(string).GetMethod(“Substring”, new Type[] { typeof(int), typeof(int) }), a, b), 
          s, a, b 
      ); 
  Func&lt;string, int, int, string&gt; fun = data.Compile(); 
  </code></pre>
  
  <p>To prevent misunderstandings, I understand the <code>Expression.Lambda</code> and <code>Expression.Call</code> constructs. What interests me is the <code>Compile()</code> method. Does it somehow produce real MSIL? Can I see the MSIL?</p>