问题
I saw there is such question in c++ I am a very begginer and I need a very simple example how to do it . the user writes code in the text box and what I need o do is to execute it how???
回答1:
You can use the classes in the System.CodeDom namespace to compile C# into in-memory assemblies, and run them on the fly. Here is a mini-tutorial.
Alternatively, you can use Reflection.Emit to construct code on the fly.
回答2:
Check the approach used in this example.
来源:https://stackoverflow.com/questions/825107/how-to-convert-string-to-code-in-c-sharp