在C#中的AppDomain的使用 [英] Usage of AppDomain in C#
问题描述
什么是应用程序域在C#中最重要的用途?
What is the most important use of AppDomains in C#?
推荐答案
在最重要使用的是你的code的必须有一个的 - 也就是一切你写在C#在的AppDomain
执行。这是非常重要的;-p
The single most important use is that your code has to have one - i.e. everything you write in C# executes in an AppDomain
. That is quite important ;-p
如果你的意思的其他的应用程序域:
If you mean additional app-domains:
在使用插件和其他不可信code,它可以让你既隔离和卸载它们(您不能卸载组件 - 只是整个应用程序域)的能力
When using plugins and other untrusted code, it allows you both isolation, and the ability to unload them (you can't unload assemblies - only entire app-domains).
我用它给目前动态加载的DLL生成的,这样我可以卸载它们。
I'm using it currently to load dynamically generated dlls, so that I can unload them.
他们还允许您设置不同的配置文件,信任级别等 - 但相关的复杂性和远程处理的成本
They also allow you to set different configuration files, trust levels, etc - but have associated costs of complexity and remoting.
MSDN对应用程序域的一部分,这里。
MSDN has a section on app-domains, here.
这篇关于在C#中的AppDomain的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!