1

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???

Jason Coon
  • 16,505
  • 10
  • 39
  • 50
  • possible duplicate of [How can I read the properties of a C# class dynamically?](http://stackoverflow.com/questions/4629/how-can-i-read-the-properties-of-a-c-sharp-class-dynamically) – Tim Cooper Jul 25 '12 at 11:35
  • Please see [http://stackoverflow.com/questions/4629/c-eval-equivalent](http://stackoverflow.com/questions/4629/c-eval-equivalent). – chaos May 05 '09 at 14:30

2 Answers2

3

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.

Reed Copsey
  • 539,124
  • 75
  • 1,126
  • 1,354
2

Check the approach used in this example.

Christian C. Salvadó
  • 769,263
  • 179
  • 909
  • 832