如何保存大会类的对象到磁盘.NET [英] How to save object of the Assembly class to disk in .NET
问题描述
我有assemvly EN coded到Base64的字符串在磁盘上。 它需要它的DLL重presentation。我可以加载到Assembly对象, 但找不到方法来保存它。谢谢!
I have assemvly encoded into Base64 string on disk. It's needed it dll representation. I can load it into Assembly object, but could not find way to save it. Thanks!
那么,1)如何保存大会类到磁盘的对象呢? 2)如何保存的base64 EN codeD组装成二进制的dll? [回答]
So, 1) how to save object of the Assembly class to disk? 2) how to save base64 encoded assembly to binary dll? [answered]
推荐答案
只是把它作为二进制 - 因此,使用 Convert.FromBase64String
获得字节[]
,写的是:
Just treat it as binary - So use Convert.FromBase64String
to get a byte[]
, and write that:
string base64 = File.ReadAllText(base64path);
byte[] binary = Convert.FromBase64String(base64);
File.WriteAllBytes(binaryPath, binary);
有关信息,在运行时对象的条件; AssemblyBuilder
有一个 .Save(...)
;但组装
不会。
For info, in terms of runtime objects; AssemblyBuilder
has a .Save(...)
; but Assembly
does not.
这篇关于如何保存大会类的对象到磁盘.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!