Side effects of calling Assembly.Load multiple times

强颜欢笑 提交于 2019-11-30 00:50:58

问题


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?


回答1:


This loads the assembly one time doesn't it?

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.



来源:https://stackoverflow.com/questions/9315716/side-effects-of-calling-assembly-load-multiple-times

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!