Use the Assembly class to load assemblies, to explore the metadata and constituent parts of assemblies, to discover the types contained in assemblies, and to create instances of those types.
To get an array of Assembly objects representing the assemblies currently loaded into an application domain (for example, the default application domain of a simple project), use the AppDomain..::.GetAssemblies method.
To load assemblies dynamically, the Assembly class provides the following static methods (Shared methods in Visual Basic). Assemblies are loaded into the application domain where the load operation occurs.
The recommended way to load assemblies is to use the Load method, which identifies the assembly to be loaded by its display name (for example, "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"). The search for the assembly follows the rules described in How the Runtime Locates Assemblies.
The ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods enable you to load an assembly for reflection, but not for execution. For example, an assembly that targets a 64-bit platform can be examined by code that is running on a 32-bit platform.
The LoadFile and LoadFrom methods are provided for rare scenarios in which an assembly must be identified by path.
To get an Assembly object for the currently executing assembly, use the GetExecutingAssembly method.
Many members of the Assembly class provide information about an assembly. For example:
The GetName method returns an AssemblyName object that provides access to the parts of the assembly display name.
The GetCustomAttributes method lists the attributes applied to the assembly.
The GetFiles method provides access to the files in the assembly manifest.
The GetManifestResourceNames method provides the names of the resources in the assembly manifest.
The GetTypes method lists all the types in the assembly. The GetExportedTypes method lists the types that are visible to callers outside the assembly. The GetType method can be used to search for a particular type in the assembly. The CreateInstance method can be used to search for and create instances of types in the assembly.
For more information on assemblies, see Application Domains and Assemblies.