title: Serialize an expression with an variable
body: <p>I wrote some classes to serialize <code>System.Linq.Expressions</code> to DataContracts to be able to send via WCF. It works quite good nice. the problem is when i want to serialize an expression that has a variable in it. here is an example to explain the problem:</p>
  
  <pre><code>public class Foo
  {
      public string Name { get; set; }
  }
  
  // CASE 1
  Expression&lt;Func&lt;Foo, bool&gt;&gt; lambda = foo =&gt; foo.Name == "Test";
  Console.WriteLine(lambda);
  // OUTPUT: foo =&gt; (foo.Name == "Test")
  
  // CASE 2
  var variable = "Test";
  lambda = foo =&gt; foo.Name == variable;            
  this.AssertExpression(lambda, "Class Lambda expression with variable.");
  // OUTPUT: foo =&gt; (foo.Name == value(MyTest+&lt;&gt;c__DisplayClass0).variable)
  </code></pre>
  
  <p>i am not having trouble to serialize the CASE 2 expression, but the the data i serialize is useless, since on the service side, there is nothing to resolve <code>value(MyTest+&lt;&gt;c__DisplayClass0).variable</code></p>
  
  <p>so i need to resolve the variables before i serialize that expression so that the CASE 2 expression serializes to same result as CASE1</p>