Click here to Skip to main content
16,012,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi !!!

I use component in application where low load form. I want to cache dll in C#??
Posted
Updated 26-Apr-11 18:39pm
v2
Comments
Sandeep Mewara 27-Apr-11 0:39am    
Not clear to me.

The framework will do this for you by loading any dll in memory. You need not worry about this at all.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 27-Apr-11 0:53am    
Even though it is not quite clear what is meant by "will do this" (what "this"), I think this answer should dismiss OP's concern. My 5.
I tried to explain why -- what really happens with those modules. Please see.
--SA
Abhinav S 27-Apr-11 0:56am    
Thanks for the 5 SA.
You should understand the following. One difference between native executable modules and .NET is that a DLL is not anything special on .NET, just an extension which can be anything. Also, there is no fundamental difference between DLL and EXE. The only special feature of EXE is a special entry point (usually "main"). In particular, an application EXE file can be loaded or referenced as an assembly in another referenced assembly exactly as it is done with DLL (and it can be a useful technique in some cases). In turn, a DLL with an implementation of a special interface can be used as EXE under a specialized host.

The fundamental concept is .NET is not EXE or DLL but assembly. The executable modules like EXE or DLL are are called modules. Visual Studio only supports creation of an assembly consisting of a single (main) module which can be found via the .NET run-time library. When an assembly is loaded with all the assemblies it references directly or indirectly, all those assemblies are loaded in one single process which is nearly insensitive to the boundaries between loaded assemblies. Same thing happens if an assembly is loaded in the process dynamically during run-time via System.Reflection.Assembly loading methods or CodeDOM. (At the same time, for each method it is possible to determine in what assembly and module it is working.) More than that, all these assemblies are loaded is a single Application Domain (System.AppDomain) unless a different Application Domain is created explicitly during run time.

All that should explain that the boundaries between assemblies are not so essential (but they are much more important in terms of permissions.) Moreover, it is good to understand that the methods are not loaded in the memory immediately. They are JIT-compiled into the machine code only on demand, on per-call basis.

—SA
 
Share this answer
 
v2
Comments
Abhinav S 27-Apr-11 0:55am    
Impressive answer. My 5.
Sergey Alexandrovich Kryukov 27-Apr-11 1:19am    
Thank you very much, Abhinav. (I was afraid it would be boring :-)
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900