有人可以解释我的Assembly类的功能给我吗?我的、我吗、功能、Assembly

2023-09-05 23:09:10 作者:- 半忧郁少年°

我要加载和运行时,有人在创建组件告诉我使用的命名空间System.Reflection.Assembly和System.Reflection.Emit。

I want to Load and Create Assemblies during runtime and someone told me to use the Namespace System.Reflection.Assembly and System.Reflection.Emit.

仅供参考,我发现在MSDN,但it's不如与它的工作。当您不知道在哪里以及如何下手。我已经用Google搜索,但我didn't找到任何有用的教程/样本/引用。

Only reference I found was on the msdn, but it´s not as good to work with it when you don´t know where and how to start. I already googled but I didn´t find any useful tutorials/samples/references.

有人能解释的功能给我或给我一些样本/教程?

Can someone explain the functionality to me or give me some samples/tutorials?

推荐答案

HTTP: //msdn.microsoft.com/en-us/library/saf5ce06.aspx

 public static void CompileScript(string source)
        {
            CompilerParameters parms = new CompilerParameters();
            parms.GenerateExecutable = true;
            parms.GenerateInMemory = true;
            parms.IncludeDebugInformation = false;
            parms.ReferencedAssemblies.Add("System.dll");
            // Add whatever references you might need here 
            CodeDomProvider compiler = CSharpCodeProvider.CreateProvider("CSharp");
            CompilerResults results = compiler.CompileAssemblyFromSource(parms, source);
            file.move(results.CompiledAssembly.Location,"c:\myassembly.dll");
        }
 
精彩推荐
图片推荐