Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.
See Also: Assembly Members
Use the System.Reflection.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 System.Reflection.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 System.Reflection.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 erload:System.AppDomain.Load method, which identifies the assembly to be loaded by its display name (for example, "System.Windows.Forms, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089"). The search for the assembly follows the rules described in How the Runtime Locates Assemblies.
The erload:System.Reflection.Assembly.ReflectionOnlyLoad and Assembly.ReflectionOnlyLoadFrom(string) 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.
Many members of the System.Reflection.Assembly class provide information about an assembly. For example:
The erload:System.Reflection.Assembly.GetCustomAttributes method lists the attributes applied to the assembly.
The erload:System.Reflection.Assembly.GetFiles method provides access to the files in the assembly manifest.
The Assembly.GetManifestResourceNames method provides the names of the resources in the assembly manifest.
The Assembly.GetTypes method lists all the types in the assembly. The Assembly.GetExportedTypes method lists the types that are visible to callers outside the assembly. The erload:System.Reflection.Assembly.GetType method can be used to search for a particular type in the assembly. The erload:System.Reflection.Assembly.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.