Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Reflection.​Assembly

Assembly: System.Runtime

Inheritance: object → Assembly

Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.

Properties

public string
CodeBase
Gets the location of the assembly as specified originally, for example, in an <see cref="T:System.Reflection.AssemblyName" /> object.
CustomAttributes
Gets a collection that contains this assembly's custom attributes.
Gets a collection of the types defined in this assembly.
public MethodInfo
EntryPoint
Gets the entry point of this assembly.
public string
EscapedCodeBase
Gets the URI, including escape characters, that represents the codebase.
Gets a collection of the public types defined in this assembly that are visible outside the assembly.
public string
FullName
Gets the display name of the assembly.
public bool
GlobalAssemblyCache
Gets a value indicating whether the assembly was loaded from the global assembly cache (.NET Framework only).
public long
HostContext
Gets the host context with which the assembly was loaded.
public string
ImageRuntimeVersion
Gets a string representing the version of the common language runtime (CLR) saved in the file containing the manifest.
public bool
IsCollectible
Gets a value that indicates whether this assembly is held in a collectible <see cref="T:System.Runtime.Loader.AssemblyLoadContext" /> .
public bool
IsDynamic
Gets a value that indicates whether the current assembly was generated dynamically in the current process by using reflection emit.
public bool
IsFullyTrusted
Gets a value that indicates whether the current assembly is loaded with full trust.
public string
Location
Gets the full path or UNC location of the loaded file that contains the manifest.
public Module
ManifestModule
Gets the module that contains the manifest for the current assembly.
Gets a collection that contains the modules in this assembly.
public bool
ReflectionOnly
Gets a <see cref="T:System.Boolean" /> value indicating whether this assembly was loaded into the reflection-only context.
SecurityRuleSet
Gets a value that indicates which set of security rules the common language runtime (CLR) enforces for this assembly.

Methods

public object
CreateInstance​(string typeName)
typeName The <see cref="P:System.Type.FullName" /> of the type to locate.
Returns An instance of the specified type created with the parameterless constructor; or <see langword="null" /> if <paramref name="typeName" /> is not found. The type is resolved using the default binder, without specifying culture or activation attributes, and with <see cref="T:System.Reflection.BindingFlags" /> set to <see langword="Public" /> or <see langword="Instance" /> .
Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search.
public object
CreateInstance​(string typeName, bool ignoreCase)
typeName The <see cref="P:System.Type.FullName" /> of the type to locate.
ignoreCase <see langword="true" /> to ignore the case of the type name; otherwise, <see langword="false" /> .
Returns An instance of the specified type created with the parameterless constructor; or <see langword="null" /> if <paramref name="typeName" /> is not found. The type is resolved using the default binder, without specifying culture or activation attributes, and with <see cref="T:System.Reflection.BindingFlags" /> set to <see langword="Public" /> or <see langword="Instance" /> .
Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search.
public object
CreateInstance​(string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, Globalization.CultureInfo culture, object[] activationAttributes)
typeName The <see cref="P:System.Type.FullName" /> of the type to locate.
ignoreCase <see langword="true" /> to ignore the case of the type name; otherwise, <see langword="false" /> .
bindingAttr A bitmask that affects the way in which the search is conducted. The value is a combination of bit flags from <see cref="T:System.Reflection.BindingFlags" /> .
binder An object that enables the binding, coercion of argument types, invocation of members, and retrieval of <see langword="MemberInfo" /> objects via reflection. If <paramref name="binder" /> is <see langword="null" /> , the default binder is used.
args An array that contains the arguments to be passed to the constructor. This array of arguments must match in number, order, and type the parameters of the constructor to be invoked. If the parameterless constructor is desired, <paramref name="args" /> must be an empty array or <see langword="null" /> .
culture An instance of <see langword="CultureInfo" /> used to govern the coercion of types. If this is <see langword="null" /> , the <see cref="T:System.Globalization.CultureInfo" /> for the current thread is used. (This is necessary to convert a string that represents 1000 to a <see cref="T:System.Double" /> value, for example, since 1000 is represented differently by different cultures.)
activationAttributes An array of one or more attributes that can participate in activation. Typically, an array that contains a single <see cref="T:System.Runtime.Remoting.Activation.UrlAttribute" /> object that specifies the URL that is required to activate a remote object. This parameter is related to client-activated objects. Client activation is a legacy technology that is retained for backward compatibility but is not recommended for new development. Distributed applications should instead use Windows Communication Foundation.
Returns An instance of the specified type, or <see langword="null" /> if <paramref name="typeName" /> is not found. The supplied arguments are used to resolve the type, and to bind the constructor that is used to create the instance.
Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search and having the specified culture, arguments, and binding and activation attributes.
public bool
Equals​(object o)
o The object to compare with this instance.
Returns <see langword="true" /> if <paramref name="o" /> is equal to this instance; otherwise, <see langword="false" /> .
Determines whether this assembly and the specified object are equal.
public object[]
GetCustomAttributes​(bool inherit)
inherit This argument is ignored for objects of type <see cref="T:System.Reflection.Assembly" /> .
Returns An array that contains the custom attributes for this assembly.
Gets all the custom attributes for this assembly.
public object[]
GetCustomAttributes​(Type attributeType, bool inherit)
attributeType The type for which the custom attributes are to be returned.
inherit This argument is ignored for objects of type <see cref="T:System.Reflection.Assembly" /> .
Returns An array that contains the custom attributes for this assembly as specified by <paramref name="attributeType" /> .
Gets the custom attributes for this assembly as specified by type.
GetCustomAttributesData​()
Returns A generic list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the current assembly.
Returns information about the attributes that have been applied to the current <see cref="T:System.Reflection.Assembly" /> , expressed as <see cref="T:System.Reflection.CustomAttributeData" /> objects.
public Type[]
GetExportedTypes​()
Returns An array that represents the types defined in this assembly that are visible outside the assembly.
Gets the public types defined in this assembly that are visible outside the assembly.
GetFile​(string name)
name The name of the specified file. Do not include the path to the file.
Returns A stream that contains the specified file, or <see langword="null" /> if the file is not found.
Gets a <see cref="T:System.IO.FileStream" /> for the specified file in the file table of the manifest of this assembly.
public IO.​FileStream[]
GetFiles​()
Returns An array of streams that contain the files.
Gets the files in the file table of an assembly manifest.
public IO.​FileStream[]
GetFiles​(bool getResourceModules)
getResourceModules <see langword="true" /> to include resource modules; otherwise, <see langword="false" /> .
Returns An array of streams that contain the files.
Gets the files in the file table of an assembly manifest, specifying whether to include resource modules.
public Type[]
GetForwardedTypes​()
public int
GetHashCode​()
Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public Module[]
GetLoadedModules​()
Returns An array of modules.
Gets all the loaded modules that are part of this assembly.
public Module[]
GetLoadedModules​(bool getResourceModules)
getResourceModules <see langword="true" /> to include resource modules; otherwise, <see langword="false" /> .
Returns An array of modules.
Gets all the loaded modules that are part of this assembly, specifying whether to include resource modules.
GetManifestResourceInfo​(string resourceName)
resourceName The case-sensitive name of the resource.
Returns An object that is populated with information about the resource's topology, or <see langword="null" /> if the resource is not found.
Returns information about how the given resource has been persisted.
public string[]
GetManifestResourceNames​()
Returns An array that contains the names of all the resources.
Returns the names of all the resources in this assembly.
public IO.​Stream
GetManifestResourceStream​(string name)
name The case-sensitive name of the manifest resource being requested.
Returns The manifest resource; or <see langword="null" /> if no resources were specified during compilation or if the resource is not visible to the caller.
Loads the specified manifest resource from this assembly.
public IO.​Stream
GetManifestResourceStream​(Type type, string name)
type The type whose namespace is used to scope the manifest resource name.
name The case-sensitive name of the manifest resource being requested.
Returns The manifest resource; or <see langword="null" /> if no resources were specified during compilation or if the resource is not visible to the caller.
Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly.
public Module
GetModule​(string name)
name The name of the module being requested.
Returns The module being requested, or <see langword="null" /> if the module is not found.
Gets the specified module in this assembly.
public Module[]
GetModules​()
Returns An array of modules.
Gets all the modules that are part of this assembly.
public Module[]
GetModules​(bool getResourceModules)
getResourceModules <see langword="true" /> to include resource modules; otherwise, <see langword="false" /> .
Returns An array of modules.
Gets all the modules that are part of this assembly, specifying whether to include resource modules.
public AssemblyName
GetName​()
Returns An object that contains the fully parsed display name for this assembly.
Gets an <see cref="T:System.Reflection.AssemblyName" /> for this assembly.
public AssemblyName
GetName​(bool copiedName)
copiedName <see langword="true" /> to set the <see cref="P:System.Reflection.Assembly.CodeBase" /> to the location of the assembly after it was shadow copied; <see langword="false" /> to set <see cref="P:System.Reflection.Assembly.CodeBase" /> to the original location.
Returns An object that contains the fully parsed display name for this assembly.
Gets an <see cref="T:System.Reflection.AssemblyName" /> for this assembly, setting the codebase as specified by <paramref name="copiedName" /> .
public void
GetObjectData​(Runtime.Serialization.SerializationInfo info, Runtime.Serialization.StreamingContext context)
info The object to be populated with serialization information.
context The destination context of the serialization.
Gets serialization information with all of the data needed to reinstantiate this assembly.
public AssemblyName[]
GetReferencedAssemblies​()
Returns An array that contains the fully parsed display names of all the assemblies referenced by this assembly.
Gets the <see cref="T:System.Reflection.AssemblyName" /> objects for all the assemblies referenced by this assembly.
public Assembly
GetSatelliteAssembly​(Globalization.CultureInfo culture)
culture The specified culture.
Returns The specified satellite assembly.
Gets the satellite assembly for the specified culture.
public Assembly
GetSatelliteAssembly​(Globalization.CultureInfo culture, Version version)
culture The specified culture.
version The version of the satellite assembly.
Returns The specified satellite assembly.
Gets the specified version of the satellite assembly for the specified culture.
public Type
GetType​(string name)
name The full name of the type.
Returns An object that represents the specified class, or <see langword="null" /> if the class is not found.
Gets the <see cref="T:System.Type" /> object with the specified name in the assembly instance.
public Type
GetType​(string name, bool throwOnError)
name The full name of the type.
throwOnError <see langword="true" /> to throw an exception if the type is not found; <see langword="false" /> to return <see langword="null" /> .
Returns An object that represents the specified class.
Gets the <see cref="T:System.Type" /> object with the specified name in the assembly instance and optionally throws an exception if the type is not found.
public Type
GetType​(string name, bool throwOnError, bool ignoreCase)
name The full name of the type.
throwOnError <see langword="true" /> to throw an exception if the type is not found; <see langword="false" /> to return <see langword="null" /> .
ignoreCase <see langword="true" /> to ignore the case of the type name; otherwise, <see langword="false" /> .
Returns An object that represents the specified class.
Gets the <see cref="T:System.Type" /> object with the specified name in the assembly instance, with the options of ignoring the case, and of throwing an exception if the type is not found.
public Type[]
GetTypes​()
Returns An array that contains all the types that are defined in this assembly.
Gets all types defined in this assembly.
public bool
IsDefined​(Type attributeType, bool inherit)
attributeType The type of the attribute to be checked for this assembly.
inherit This argument is ignored for objects of this type.
Returns <see langword="true" /> if the attribute has been applied to the assembly; otherwise, <see langword="false" /> .
Indicates whether or not a specified attribute has been applied to the assembly.
public Module
LoadModule​(string moduleName, byte[] rawModule)
moduleName The name of the module. This string must correspond to a file name in this assembly's manifest.
rawModule A byte array that is a COFF-based image containing an emitted module, or a resource.
Returns The loaded module.
Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file.
public Module
LoadModule​(string moduleName, byte[] rawModule, byte[] rawSymbolStore)
moduleName The name of the module. This string must correspond to a file name in this assembly's manifest.
rawModule A byte array that is a COFF-based image containing an emitted module, or a resource.
rawSymbolStore A byte array containing the raw bytes representing the symbols for the module. Must be <see langword="null" /> if this is a resource file.
Returns The loaded module.
Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file. The raw bytes representing the symbols for the module are also loaded.
public string
ToString​()
Returns The full name of the assembly, or the class name if the full name of the assembly cannot be determined.
Returns the full name of the assembly, also known as the display name.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .