Compiling and running C# code programmatically
<p>I have a C# application, and I want to run a function which is defined in text to take one parameter of class A and return a double.</p>

<p>Parameter "A" will be some structured data, and the function will be a formula upon A.  </p>

<p>(Imagine A had properties num1, num2, and one formula was defined to return the average, another arbitrarily to return num1 * 2).</p>

<p>As such, I want to load my function definition from a text source, compile them in some manner, and execute them.</p>

<p>In terms of the structure of the code, I do suppose I could inject the body of the function to be a member function of an arbitrary class, or if I can compile a delegate and then execute it passing a parameter context that would be sufficient also.</p>

<p>What is the way to go about this?</p>
