问题描述
如果一个叫的Assembly.Load
多次不会造成任何副作用?
例如。
的for(int i = 0; I&n种;我++)
{
的Assembly.Load(assemblyStrongName);
// .......
}
此加载程序集一次,不是吗?我已经与 AppDomain.CurrentDomain.GetAssemblies()检查
之前和之后,似乎它的加载一次(因为它应该),但它有副作用吗?
在一个长期运行的服务器应用程序(运行数月/年,没有重新启动)完成了上述原因的任何问题?
是的。该组件被加载到当前的AppDomain,并且只能使用一次加载到AppDomain中。调用此多次刚刚返回现有组件。
If one calls Assembly.Load
multiple times does it cause any side effects?
e.g.
for (int i = 0; i < N; i++)
{
Assembly.Load(assemblyStrongName);
// .......
}
This loads the assembly one time doesn't it? I've checked with AppDomain.CurrentDomain.GetAssemblies()
before and after and it seems it's loaded one time (as it should) but does it have side effects?
In a long running server application (runs for months/years with no restart) does the above cause any issues?
Yes. The assembly gets loaded into the current AppDomain, and will only be loaded once into that AppDomain. Calling this multiple times just returns the existing assembly.
这篇关于调用的Assembly.Load多次的副作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!