Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Class Loader - What is it?

Tags:

.net

I can't find any good documentation on what the concept of a Class Loader is in the .NET Framework? What is it? Where can it be found? Does anyone know?

like image 788
user118190 Avatar asked Jun 01 '10 04:06

user118190


2 Answers

In .NET assemblies are the fundamental unit of deployment. The technology that actually loads the assemblies is called Fusion. For more details on that read the .NET Fusion Workshop. Each assembly has its own class loader to load types from that assembly.

Hosting the Common Language Runtime may also be of interest.

I don't think that Class Loader in .NET holds the same importance or power as it does in Java. The loading of the class would be handled by the assembly's class loader.

Dynamic loading would usually be done by loading the assembly and then instantiating the class:

Assembly assembly = Assembly.LoadFrom("assemblyName");
Type type = assembly.GetType("className");
object x = Activator.CreateInstance(type);
like image 191
Randy supports Monica Avatar answered Oct 29 '22 17:10

Randy supports Monica


Randy Levy's didn't answer all. Class loader did more jobs than Assembly.LoadFrom. Because there isn't a method like ‘Assembly.Unload'. The assemblies could be only unloaded by closing appdomain. Java's class loader can do lot of more than Randy Levy's answer. Here tag a better answer in stackoverflow Equivalent of Class Loaders in .NET

like image 35
Bo HU Avatar answered Oct 29 '22 17:10

Bo HU