user118190
user118190

Reputation: 2179

.NET Class Loader - What is it?

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?

Upvotes: 13

Views: 16184

Answers (3)

Randy Levy
Randy Levy

Reputation: 22655

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);

Upvotes: 16

Bo HU
Bo HU

Reputation: 155

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

Upvotes: 6

user354889
user354889

Reputation:

What do you mean? A similar concept to the Java class loaders? In .Net the concept is mapped to AppDomain (just search for AppDomain)

Upvotes: 2

Related Questions