简体   繁体   English

访问内存组合件

[英]Accessing in memory assembly

I am looking at creating and dynamically compiling an assembly in memory from serialized code. 我正在研究如何从序列化代码创建并动态编译内存中的程序集。 Is it possible to dump or access the memory to gain access to the code of the assembly? 是否可以转储或访问内存以访问程序集的代码?

That depends on how you create the assembly.For example, if you use the CSharpCodeProvider , you can set CompilerParameters that will save the assembly in memory or to a file. 这取决于创建程序集的方式。例如,如果使用CSharpCodeProvider ,则可以设置CompilerParameters ,将程序集保存在内存或文件中。 Or both. 或两者。 You could then read the output file. 然后,您可以读取输出文件。

You could also define a dynamic assembly and then save it to disk. 您还可以定义一个动态程序集 ,然后将其保存到磁盘。

In either case, you can access the code and other information in the assembly using reflection (ie System.Reflection.Assembly ). 无论哪种情况,都可以使用反射来访问程序集中的代码和其他信息(即System.Reflection.Assembly )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM