title: C# .NET 4.0 expression eval
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/4629/c-eval-equivalent">C# eval equivalent?</a><br>
    <a href="https://stackoverflow.com/questions/53844/how-can-i-evaluate-a-c-expression-dynamically">How can I evaluate a C# expression dynamically?</a>  </p>
  </blockquote>
  
  
  
  <p>How can I evaluate a valid C# code and get results inside a compiled program (dynamically)?
  I know this is not very clear, i'll try to show that with a code snippet:</p>
  
  <p>Visual C# 2010.</p>
  
  <pre><code>double x = 3.0;//this is function argument, we'll take 3
  string str = "Math.Pow(x,2)+2*x+4";//value with written function in C#,equals: x^2+2x+4
  double y = eval(str);
  /* this is the idea! something like JS.I want to make string parsed into parameter,i.e
  y=19 - this is what double y should became after eval(str) */
  </code></pre>
  
  <p>Hope you got the idea.</p>
  
  <p>Thanks.</p>