如何使用C#卸载该.dll? [英] How to unload the .dll using c#?

查看:94
本文介绍了如何使用C#卸载该.dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的.dll参考我的申请。
我想卸载一个按钮单击事件.dll文件。
怎么办呢?

I am using .dll reference to my application. i want to unload the .dll in a button click event. How to do it ???

推荐答案

您不能卸载单个程序集 - 你必须卸载整个的AppDomain 。换句话说,你需要在一个新的的AppDomain 来加载其他组件(以及相关的代码),那么当你要卸载它,你卸载<$ C $ 。C>的AppDomain

You can't unload an individual assembly - you have to unload a whole AppDomain. In other words, you'll need to load your other assembly (and associated code) in a new AppDomain, then when you want to unload it you unload the AppDomain.

当然,这使得生活变得更难,因为你不必担心编组的AppDomain之间的呼叫 - 但它的一切, .NET允许。

Of course, this makes life a lot harder as you have to worry about marshalling calls between AppDomains - but it's all that .NET allows.

这篇关于如何使用C#卸载该.dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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