Assembly Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.
Assembly: mscorlib (in mscorlib.dll)
The Assembly type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | CustomAttributes | Gets a collection that contains this assembly's custom attributes. |
![]() | DefinedTypes | Gets a collection of the types defined in this assembly. |
![]() | EntryPoint | Gets the entry point of this assembly. |
![]() | ExportedTypes | Gets a collection of the public types defined in this assembly that are visible outside the assembly. |
![]() | FullName | Gets the display name of the assembly. |
![]() | ImageRuntimeVersion | Gets a string representing the version of the common language runtime (CLR) saved in the file containing the manifest. |
![]() | IsDynamic | Gets a value that indicates whether the current assembly was generated dynamically in the current process by using reflection emit. |
![]() | ManifestModule | Gets the module that contains the manifest for the current assembly. |
![]() | Modules | Gets a collection that contains the modules in this assembly. |
| Name | Description | |
|---|---|---|
![]() | CreateInstance | Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search. |
![]() | Equals | Determines whether this assembly and the specified object are equal. (Overrides Object::Equals(Object).) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GetCallingAssembly | Returns the Assembly of the method that invoked the currently executing method. |
![]() | GetCustomAttributes(Boolean) | Gets all the custom attributes for this assembly. |
![]() | GetCustomAttributes(Type, Boolean) | Gets the custom attributes for this assembly as specified by type. |
![]() ![]() | GetExecutingAssembly | Gets the assembly that contains the code that is currently executing. |
![]() | GetExportedTypes | Gets the types defined in this assembly that are visible outside the assembly. |
![]() | GetHashCode | Returns the hash code for this instance. (Overrides Object::GetHashCode().) |
![]() | GetManifestResourceInfo | Returns information about how the given resource has been persisted. |
![]() | GetManifestResourceNames | Returns the names of all the resources in this assembly. |
![]() | GetManifestResourceStream(String) | Loads the specified manifest resource from this assembly. |
![]() | GetManifestResourceStream(Type, String) | Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly. |
![]() | GetModules | Gets all the modules that are part of this assembly. |
![]() | GetName() | Security Critical. Gets an AssemblyName for this assembly. |
![]() | GetName(Boolean) | Security Critical. Gets an AssemblyName for this assembly, setting the codebase as specified by copiedName. |
![]() | GetSatelliteAssembly(CultureInfo) | Gets the satellite assembly for the specified culture. |
![]() | GetSatelliteAssembly(CultureInfo, Version) | Gets the specified version of the satellite assembly for the specified culture. |
![]() | GetType() | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetType(String) | Gets the Type object with the specified name in the assembly instance. |
![]() | GetType(String, Boolean) | Gets the Type object with the specified name in the assembly instance and optionally throws an exception if the type is not found. |
![]() | GetTypes | Gets the types defined in this assembly. |
![]() | IsDefined | Indicates whether or not a specified attribute has been applied to the assembly. |
![]() ![]() | Load(AssemblyName) | Security Critical. Loads an assembly given its AssemblyName. |
![]() ![]() | Load(String) | Loads an assembly given the long form of its name. |
![]() ![]() | LoadFrom | Security Critical. Loads an assembly given its file name or path. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns the full name of the assembly, also known as the display name. (Overrides Object::ToString().) |
| Name | Description | |
|---|---|---|
![]() | GetCustomAttribute(Type) | Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified assembly. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttribute<T>() | Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified assembly. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttributes() | Overloaded. Retrieves a collection of custom attributes that are applied to a specified assembly. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttributes(Type) | Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified assembly. (Defined by CustomAttributeExtensions.) |
![]() | GetCustomAttributes<T>() | Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified assembly. (Defined by CustomAttributeExtensions.) |
![]() | IsDefined | Indicates whether custom attributes of a specified type are applied to a specified assembly. (Defined by CustomAttributeExtensions.) |
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 load assemblies dynamically, the Assembly class provides the static Load(String) method overload (Shared method overload in Visual Basic). Assemblies are loaded into the Windows Phone application domain. Other overloads can be called only by the trusted assemblies in the .NET Framework.
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 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.
The following code example shows how to obtain the currently executing assembly, create an instance of a type contained in that assembly, and invoke one of the type's methods with late binding. For this purpose, the code example defines a class named Example, with a method named SampleMethod. The constructor of the class accepts an integer, which is used to compute the return value of the method.
The code example also demonstrates the use of the GetName method to obtain an AssemblyName object that can be used to parse the full name of the assembly. The example displays the version number of the assembly and the EntryPoint property.




