📜  c# 在运行时编译代码 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:45.739000             🧑  作者: Mango

代码示例1
using System.CodeDom.Compiler;

CSharpCodeProvider codeProvider = new CSharpCodeProvider();
CompilerParameters myParameters = new CompilerParameters();
myParameters.GenerateExecutable = false;
myParameters.OutputAssembly = @"C:\assembly.dll";
CompilerResults results = codeProvider.CompileAssemblyFromSource(myParameters, code);