title: How can I turn a string into a runnable piece of code in c#
body: <p>In a program I'm creating, I need to be able to convert a string variable into a runnable piece of code in C#.</p>
  
  <p>For example we would have</p>
  
  <pre><code>String code = "console.Writeline("hello");"
  
  function(code);
  
  double function(String var) {
       // turn var into code
       // run var
  }
  </code></pre>
  
  <p>Any feedback would be much appreciated.</p>