[英]Dynamic C# code execution
I need to run small snippets of C# code for educational purposes and for each execution, I should open the project (solution), delete existing code, type new code, build and compile, and then run the project.为了教育目的,我需要运行 C# 代码的小片段,对于每次执行,我应该打开项目(解决方案),删除现有代码,键入新代码,构建和编译,然后运行项目。 For example, for executing
string.IsNullOrEmpty("something")
I should follow all this procedure.例如,为了执行
string.IsNullOrEmpty("something")
我应该遵循所有这些过程。 I just thought of something like:我只是想到了类似的东西:
In which I can enter code snippets, click execute, and then see the result.我可以在其中输入代码片段,单击执行,然后查看结果。 Is there anyway to do that?
有没有办法做到这一点?
Take a look at Snippet Compiler .看看片段编译器。
Not exactly what you're asking for, but from what I can tell it seems pretty close.不完全是您要求的,但据我所知,它似乎非常接近。
There is also mono's csharp/gsharp:还有mono的csharp/gsharp:
see http://www.mono-project.com/CsharpRepl见http://www.mono-project.com/CsharpRepl
Mono are doing the compiler as service stuff - this is what you are looking for: http://tirania.org/blog/archive/2010/Apr-27.html Mono 将编译器作为服务的东西 - 这就是你要找的东西: http://tirania.org/blog/archive/2010/Apr-27.ZFC35FDC70D5FC69D269883A8EZ7
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.