title: c# convert string to int in expression
body: <p>I'm working on a small project that transforms a list of functions into c# code. 
  For example: temp1.greaterThan(1); temp2.contains("a");
  temp1, temp2 are expression variables in string type.
  The source code is:</p>
  
  <pre><code>var temp1 = Expression.Variable(typeof(string), "temp1");   
  </code></pre>
  
  <p>So I think I need to convert temp1 into an integer variable.
  I've tried following ways but none worked:</p>
  
  <pre><code>Expression greaterThan = Expression.GreaterThan(temp1, Expression.Constant(1));
  </code></pre>
  
  <p>It will throw exeption because temp1 is string and hence cannot compare with 1.</p>
  
  <pre><code>Expression.GreaterThan(Expression.Call(typeof(int).GetMethod("Parse"), temp1), Expression.Constant(1));
  </code></pre>
  
  <p>It throws "Ambiguous match found." exception</p>
  
  <pre><code>Expression.GreaterThan(Expression.Call(typeof(Convert).GetMethod("ToInt32"), temp1), Expression.Constant(1));
  </code></pre>
  
  <p>Same exception: Ambiguous match found.</p>
  
  <pre><code>Expression.GreaterThan(Expression.Convert(temp1,typeof(Int32)), Expression.Constant(1));
  </code></pre>
  
  <p>Exception: No coercion operator is defined between types 'System.String' and 'System.Int32'.</p>
  
  <p>So I'm thinking i would need to have a convert method inside the Expression.GreaterThan method.
  Anyone has an idea?
  Many thanks.</p>