从code文件执行C#code运行时文件、code

2023-09-02 20:41:48 作者:无畏

我有一个 WPF C#应用程序包含一个按钮。

I have a WPF C# application that contains a button.

的按钮,单击code被写入其中将放置在应用程序运行时目录单独的文本文件。

The code of the button click is written in separate text file which will be placed in the applications runtime directory.

我要的的执行的的code放置在文本文件上按一下按钮。

I want to execute that code placed in the text file on the click of the button.

不知道如何做到这一点?

Any idea how to do this?

推荐答案

您可以使用Microsoft.CSharp.CSharp$c$cProvider编译code上的动态。尤其是看到CompileAssemblyFromFile.