Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Assembly.Load use cache?

I have a resource assembly which stores a lot of reusable scripts, styles and controls. I'm not sure if I should cache this assembly after loading it. Does Assembly.Load use internal cache within the same app-domain?

Thank you!

like image 280
Sergey Akopov Avatar asked Oct 27 '25 22:10

Sergey Akopov


2 Answers

Assemblies when loaded into an AppDomain remain loaded, so there is nothing for you to do, this is the default behaviour.

In fact you will have an issue if you want to unload an Assembly, in that case you need to unload the entire AppDomain, that's why you would often load an assembly into a new AppDomain in your case you wouldn't need to go to that effort.

like image 59
Tim Jarvis Avatar answered Oct 30 '25 12:10

Tim Jarvis


It is unclear what sort of "caching" you mean, but once assembly is loaded into AddDomain it remains loaded till AppDomain shut down. So likley you don't need to do any additional caching.

like image 24
Alexei Levenkov Avatar answered Oct 30 '25 11:10

Alexei Levenkov