如何将字符串转换为C#中的代码

发布于 2024-07-19 08:23:46 字数 82 浏览 2 评论 0原文

我看到c++中有这样的问题 我是一个非常初学者,我需要一个非常简单的例子如何做到这一点。 用户在文本框中写入代码,我需要做的是执行它 如何???

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你如我软肋 2024-07-26 08:23:46

您可以使用 System.CodeDom 命名空间中的类将 C# 编译为内存中的程序集,并即时运行它们。 这是一个迷你教程

或者,您可以使用 Reflection.Emit 动态构建代码。

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.

兔姬 2024-07-26 08:23:46

检查此示例中使用的方法。

Check the approach used in this example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文