如何删除适用于类属性的组件? [英] How can I delete an assembly applied to the class property?

查看:99
本文介绍了如何删除适用于类属性的组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有公开征集LoadedAssembly {设置一类;得到; }

var assemblyName = AssemblyName.GetAssemblyName(fullPathToDLLFile);
myClass.LoadedAssembly = Assembly.Load(assemblyName);

这班我一直在 Application.Current.Properties [MyClass的]

我尝试空它像 Application.Current.Properties [MyClass的] = NULL; ,但它并不能帮助

I try to null it like Application.Current.Properties["MyClass"] = null; but it doesn't help.

我看到加载的程序集的作品(它有一个计时器内,其工作)。

我如何能清洗吗?

(我不使用类似的AppDomain D ​​= AppDomain.CreateDomain(NEWDOMAIN,空,domaininfo); 加载程序集)

(I don't use something like AppDomain d = AppDomain.CreateDomain("NewDomain", null, domaininfo); to load assembly.)

推荐答案

您不能随意卸载的组件,而是必须卸载大会在其中加载应用程序域(其卸载所有组件中的应用程序域)。如果你没有加载到一个单独的AppDomain中,那么唯一的办法做到这一点是将关闭应用程序。

You can't arbitrarily unload an assembly, you must instead unload the AppDomain in which the assembly is loaded (which unloads all assemblies in the AppDomain). If you're not loading it into a separate AppDomain, then the only way to do that would be to shut down the application.

有在这个问题上这是为什么不支持细节的各个环节:<一href="http://stackoverflow.com/questions/123391/how-to-unload-an-assembly-from-the-primary-appdomain">How从主AppDomain卸载程序集?

There are various links in this question with details on why this is not supported: How to unload an assembly from the primary AppDomain?

这篇关于如何删除适用于类属性的组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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