Just wanted to know if there is any difference between the two, in the context of a fully trust asp.net mvc 2 application.
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
- Install ASP.NET 5.0 version of System.ServiceModel
相关文章
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
- entity type has no key defined - Code first
The .NET Framework defers loading assemblies into the current AppDomain until they're needed. For example, if you call into a third-party library only from SomeMethod(), the third-party DLL normally won't be loaded until the first time SomeMethod() runs.
AppDomain.GetAssemblies() gives you all assemblies which have already been loaded into the current AppDomain. BuildManager.GetReferencedAssemblies() returns a list of all assemblies referenced from Web.config and elsewhere, and it loads those assemblies into the current AppDomain.
Here's a worked-out example of the above.
In this example, the CLR defers loading ThirdParty.dll into the current AppDomain until it's absolutely necessary. And since it's necessary for the execution of SomeMethod(), that's when it gets loaded.
Alternatively:
Here, even though you never called SomeMethod(), the call to BuildManager.GetReferencedAssemblies() loaded the third-party library into the current AppDomain on your behalf.
Of course, this is all subject to certain optimizations, etc., but the general idea holds.