Reputation: 4900
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?
Upvotes: 24
Views: 6642
Reputation: 564811
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.
Upvotes: 26