Loading .NET Assemblies

The System.Reflection.Assembly class represents a physical .NET executable, either an .exe or a .dll file. The System.Reflection.Assembly class can be used to load assemblies, load modules, or discover a type from the assembly and create an instance of it. The Assembly class does not have a public constructor, so in order to get a reference to an Assembly instance, you must use a static method on the Assembly class itself. The static method LoadFrom loads an assembly given its filename. This method loads the assembly into the AppDomain of the caller and returns an Assembly instance that represents the loaded assembly. Listing 13.1 demonstrates how to load an assembly by using the LoadFrom method.

Listing 13.1.
 C# Assembly ...

Get Microsoft® .NET Compact Framework Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.