how to convert string to code in c# [closed]

不问归期 提交于 2020-01-01 04:01:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!