Is it possble to compile a string into code without having to compile an entire new class?
Ive seen lots of tutorials and I have watched the documentations of the CodeDom
framework, but in all of those it creates a new class and everything, what I want is to just compile 1 line and add it into the original code f.e.
string code = "5 + 1";
How can I compile that and at runtime use it like something like this:
double number = CompileAndCall("5 + 1");
CompileAndCall()
should in some way convert the code to this:
return (double)5 + 1;
This should return the result ((double)6
) from the method and store it in the number
variable.