title: converting a .net Func<T> to a .net Expression<Func<T>>
body: <p>Going from a lambda to an Expression is easy using a method call...</p>
  
  <pre><code>public void GimmeExpression(Expression&lt;Func&lt;T&gt;&gt; expression)
  {
      ((MemberExpression)expression.Body).Member.Name; // "DoStuff"
  }
  
  public void SomewhereElse()
  {
      GimmeExpression(() =&gt; thing.DoStuff());
  }
  </code></pre>
  
  <p>But I would like to turn the Func in to an expression, only in rare cases...</p>
  
  <pre><code>public void ContainTheDanger(Func&lt;T&gt; dangerousCall)
  {
      try 
      {
          dangerousCall();
      }
      catch (Exception e)
      {
          // This next line does not work...
          Expression&lt;Func&lt;T&gt;&gt; DangerousExpression = dangerousCall;
          var nameOfDanger = 
              ((MemberExpression)dangerousCall.Body).Member.Name;
          throw new DangerContainer(
              "Danger manifested while " + nameOfDanger, e);
      }
  }
  
  public void SomewhereElse()
  {
      ContainTheDanger(() =&gt; thing.CrossTheStreams());
  }
  </code></pre>
  
  <p>The line that does not work gives me the compile-time error <code>Cannot implicitly convert type 'System.Func&lt;T&gt;' to 'System.Linq.Expressions.Expression&lt;System.Func&lt;T&gt;&gt;'</code>. An explicit cast does not resolve the situation. Is there a facility to do this that I am overlooking?</p>