如何加载程序集,而无需使用的Assembly.Load? [英] How to load an assembly without using Assembly.Load?

查看:319
本文介绍了如何加载程序集,而无需使用的Assembly.Load?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能通过流装配到内存中做到这一点?如果是这样,一个人如何做到这一点。

Is it possible to do this by streaming the assembly into memory? If so, how does one do this?

原因:

我不想锁定DLL这是加载。我想有动态加载,更改代码,编译和重新加载它

I don't want to lock the dll that's loaded. I want to have the ability to dynamically load, change the code, compile and reload it again

推荐答案

它可以通过完成工作的能力使用字节数组负荷过载。你需要阅读负荷前的组装字节,它不会锁定该文件:

It can be done by an overload of Load using byte array. You need to read the assembly bytes before the load and it won't lock the file:

byte[] readAllBytes = File.ReadAllBytes("path");
Assembly assembly = Assembly.Load(readAllBytes);

这篇关于如何加载程序集,而无需使用的Assembly.Load?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆