mscorlib(4.0.0.0) API with additions
System.Reflection.Assembly Class Reference

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

Inheritance diagram for System.Reflection.Assembly:
[legend]
Collaboration diagram for System.Reflection.Assembly:
[legend]

Public Member Functions

override bool Equals (object o)
 Determines whether this assembly and the specified object are equal. More...
 
override int GetHashCode ()
 Returns the hash code for this instance. More...
 
virtual AssemblyName GetName ()
 Gets an T:System.Reflection.AssemblyName for this assembly. More...
 
virtual AssemblyName GetName (bool copiedName)
 Gets an T:System.Reflection.AssemblyName for this assembly, setting the codebase as specified by copiedName . More...
 
virtual Type GetType (string name)
 Gets the T:System.Type object with the specified name in the assembly instance. More...
 
virtual Type GetType (string name, bool throwOnError)
 Gets the T:System.Type object with the specified name in the assembly instance and optionally throws an exception if the type is not found. More...
 
virtual Type GetType (string name, bool throwOnError, bool ignoreCase)
 Gets the 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. More...
 
virtual Type [] GetExportedTypes ()
 Gets the public types defined in this assembly that are visible outside the assembly. More...
 
virtual Type [] GetTypes ()
 Gets the types defined in this assembly. More...
 
virtual Stream GetManifestResourceStream (Type type, string name)
 Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly. More...
 
virtual Stream GetManifestResourceStream (string name)
 Loads the specified manifest resource from this assembly. More...
 
virtual Assembly GetSatelliteAssembly (CultureInfo culture)
 Gets the satellite assembly for the specified culture. More...
 
virtual Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
 Gets the specified version of the satellite assembly for the specified culture. More...
 
virtual void GetObjectData (SerializationInfo info, StreamingContext context)
 Gets serialization information with all of the data needed to reinstantiate this assembly. More...
 
virtual object [] GetCustomAttributes (bool inherit)
 Gets all the custom attributes for this assembly. More...
 
virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
 Gets the custom attributes for this assembly as specified by type. More...
 
virtual bool IsDefined (Type attributeType, bool inherit)
 Indicates whether or not a specified attribute has been applied to the assembly. More...
 
virtual IList< CustomAttributeDataGetCustomAttributesData ()
 Returns information about the attributes that have been applied to the current T:System.Reflection.Assembly, expressed as T:System.Reflection.CustomAttributeData objects. More...
 
Module LoadModule (string moduleName, byte[] rawModule)
 Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file. More...
 
virtual Module LoadModule (string moduleName, byte[] rawModule, byte[] rawSymbolStore)
 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. More...
 
object CreateInstance (string typeName)
 Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search. More...
 
object CreateInstance (string typeName, bool ignoreCase)
 Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search. More...
 
virtual object CreateInstance (string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
 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. More...
 
Module [] GetLoadedModules ()
 Gets all the loaded modules that are part of this assembly. More...
 
virtual Module [] GetLoadedModules (bool getResourceModules)
 Gets all the loaded modules that are part of this assembly, specifying whether to include resource modules. More...
 
Module [] GetModules ()
 Gets all the modules that are part of this assembly. More...
 
virtual Module [] GetModules (bool getResourceModules)
 Gets all the modules that are part of this assembly, specifying whether to include resource modules. More...
 
virtual Module GetModule (string name)
 Gets the specified module in this assembly. More...
 
virtual FileStream GetFile (string name)
 Gets a T:System.IO.FileStream for the specified file in the file table of the manifest of this assembly. More...
 
virtual FileStream [] GetFiles ()
 Gets the files in the file table of an assembly manifest. More...
 
virtual FileStream [] GetFiles (bool getResourceModules)
 Gets the files in the file table of an assembly manifest, specifying whether to include resource modules. More...
 
virtual string [] GetManifestResourceNames ()
 Returns the names of all the resources in this assembly. More...
 
virtual AssemblyName [] GetReferencedAssemblies ()
 Gets the T:System.Reflection.AssemblyName objects for all the assemblies referenced by this assembly. More...
 
virtual ManifestResourceInfo GetManifestResourceInfo (string resourceName)
 Returns information about how the given resource has been persisted. More...
 
override string ToString ()
 Returns the full name of the assembly, also known as the display name. More...
 

Static Public Member Functions

static string CreateQualifiedName (string assemblyName, string typeName)
 Creates the name of a type qualified by the display name of its assembly. More...
 
static Assembly GetAssembly (Type type)
 Gets the currently loaded assembly in which the specified type is defined. More...
 
static bool operator== (Assembly left, Assembly right)
 Indicates whether two T:System.Reflection.Assembly objects are equal. More...
 
static bool operator != (Assembly left, Assembly right)
 Indicates whether two T:System.Reflection.Assembly objects are not equal. More...
 
static Assembly LoadFrom (string assemblyFile)
 Loads an assembly given its file name or path. More...
 
static Assembly ReflectionOnlyLoadFrom (string assemblyFile)
 Loads an assembly into the reflection-only context, given its path. More...
 
static Assembly LoadFrom (string assemblyFile, Evidence securityEvidence)
 Loads an assembly given its file name or path and supplying security evidence. More...
 
static Assembly LoadFrom (string assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
 Loads an assembly given its file name or path, security evidence, hash value, and hash algorithm. More...
 
static Assembly LoadFrom (string assemblyFile, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
 Loads an assembly given its file name or path, hash value, and hash algorithm. More...
 
static Assembly UnsafeLoadFrom (string assemblyFile)
 Loads an assembly into the load-from context, bypassing some security checks. More...
 
static Assembly Load (string assemblyString)
 Loads an assembly given the long form of its name. More...
 
static Assembly ReflectionOnlyLoad (string assemblyString)
 Loads an assembly into the reflection-only context, given its display name. More...
 
static Assembly Load (string assemblyString, Evidence assemblySecurity)
 Loads an assembly given its display name, loading the assembly into the domain of the caller using the supplied evidence. More...
 
static Assembly Load (AssemblyName assemblyRef)
 Loads an assembly given its T:System.Reflection.AssemblyName. More...
 
static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
 Loads an assembly given its T:System.Reflection.AssemblyName. The assembly is loaded into the domain of the caller using the supplied evidence. More...
 
static Assembly LoadWithPartialName (string partialName)
 Loads an assembly from the application directory or from the global assembly cache using a partial name. More...
 
static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
 Loads an assembly from the application directory or from the global assembly cache using a partial name. The assembly is loaded into the domain of the caller using the supplied evidence. More...
 
static Assembly Load (byte[] rawAssembly)
 Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the application domain of the caller. More...
 
static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
 Loads the assembly from a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the reflection-only context of the caller's application domain. More...
 
static Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore)
 Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols for the assembly. The assembly is loaded into the application domain of the caller. More...
 
static Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, SecurityContextSource securityContextSource)
 Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and specifying the source for the security context. The assembly is loaded into the application domain of the caller. More...
 
static Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence)
 Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and evidence for the assembly. The assembly is loaded into the application domain of the caller. More...
 
static Assembly LoadFile (string path)
 Loads the contents of an assembly file on the specified path. More...
 
static Assembly LoadFile (string path, Evidence securityEvidence)
 Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence. More...
 
static Assembly GetExecutingAssembly ()
 Gets the assembly that contains the code that is currently executing. More...
 
static Assembly GetCallingAssembly ()
 Returns the T:System.Reflection.Assembly of the method that invoked the currently executing method. More...
 
static Assembly GetEntryAssembly ()
 Gets the process executable in the default application domain. In other application domains, this is the first executable that was executed by M:System.AppDomain.ExecuteAssembly(System.String). More...
 

Properties

virtual string CodeBase [get]
 Gets the location of the assembly as specified originally, for example, in an T:System.Reflection.AssemblyName object. More...
 
virtual string EscapedCodeBase [get]
 Gets the URI, including escape characters, that represents the codebase. More...
 
virtual string FullName [get]
 Gets the display name of the assembly. More...
 
virtual MethodInfo EntryPoint [get]
 Gets the entry point of this assembly. More...
 
virtual IEnumerable< TypeExportedTypes [get]
 Gets a collection of the public types defined in this assembly that are visible outside the assembly. More...
 
virtual IEnumerable< TypeInfoDefinedTypes [get]
 Gets a collection of the types defined in this assembly. More...
 
virtual Evidence Evidence [get]
 Gets the evidence for this assembly. More...
 
virtual PermissionSet PermissionSet [get]
 Gets the grant set of the current assembly. More...
 
bool IsFullyTrusted [get]
 Gets a value that indicates whether the current assembly is loaded with full trust. More...
 
virtual SecurityRuleSet SecurityRuleSet [get]
 Gets a value that indicates which set of security rules the common language runtime (CLR) enforces for this assembly. More...
 
virtual Module ManifestModule [get]
 Gets the module that contains the manifest for the current assembly. More...
 
virtual IEnumerable< CustomAttributeDataCustomAttributes [get]
 Gets a collection that contains this assembly's custom attributes. More...
 
virtual bool ReflectionOnly [get]
 Gets a T:System.Boolean value indicating whether this assembly was loaded into the reflection-only context. More...
 
virtual IEnumerable< ModuleModules [get]
 Gets a collection that contains the modules in this assembly. More...
 
virtual string Location [get]
 Gets the full path or UNC location of the loaded file that contains the manifest. More...
 
virtual string ImageRuntimeVersion [get]
 Gets a string representing the version of the common language runtime (CLR) saved in the file containing the manifest. More...
 
virtual bool GlobalAssemblyCache [get]
 Gets a value indicating whether the assembly was loaded from the global assembly cache. More...
 
virtual long HostContext [get]
 Gets the host context with which the assembly was loaded. More...
 
virtual bool IsDynamic [get]
 Gets a value that indicates whether the current assembly was generated dynamically in the current process by using reflection emit. More...
 
virtual ModuleResolveEventHandler ModuleResolve
 Occurs when the common language runtime class loader cannot resolve a reference to an internal module of an assembly through normal means. More...
 
- Properties inherited from System.Runtime.InteropServices._Assembly
string CodeBase [get]
 Provides COM objects with version-independent access to the P:System.Reflection.Assembly.CodeBase property. More...
 
string EscapedCodeBase [get]
 Provides COM objects with version-independent access to the P:System.Reflection.Assembly.EscapedCodeBase property. More...
 
string FullName [get]
 Provides COM objects with version-independent access to the P:System.Reflection.Assembly.FullName property. More...
 
MethodInfo EntryPoint [get]
 Provides COM objects with version-independent access to the P:System.Reflection.Assembly.EntryPoint property. More...
 
string Location [get]
 Provides COM objects with version-independent access to the P:System.Reflection.Assembly.Location property. More...
 
Evidence Evidence [get]
 Provides COM objects with version-independent access to the P:System.Reflection.Assembly.Evidence property. More...
 
bool GlobalAssemblyCache [get]
 Provides COM objects with version-independent access to the P:System.Reflection.Assembly.GlobalAssemblyCache property. More...
 
- Properties inherited from System.Security.IEvidenceFactory
Evidence Evidence [get]
 Gets T:System.Security.Policy.Evidence that verifies the current object's identity. More...
 

Additional Inherited Members

- Events inherited from System.Runtime.InteropServices._Assembly
ModuleResolveEventHandler ModuleResolve
 Provides COM objects with version-independent access to the E:System.Reflection.Assembly.ModuleResolve event. More...
 

Detailed Description

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

Definition at line 22 of file Assembly.cs.

Member Function Documentation

◆ CreateInstance() [1/3]

object System.Reflection.Assembly.CreateInstance ( string  typeName)

Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search.

Parameters
typeNameThe P:System.Type.FullName of the type to locate.
Returns
An instance of the specified type created with the default constructor; or null if typeName is not found. The type is resolved using the default binder, without specifying culture or activation attributes, and with T:System.Reflection.BindingFlags set to Public or Instance.
Exceptions
T:System.ArgumentExceptiontypeName is an empty string ("") or a string beginning with a null character.-or-The current assembly was loaded into the reflection-only context.
T:System.ArgumentNullExceptiontypeName is null.
T:System.MissingMethodExceptionNo matching constructor was found.
T:System.IO.FileNotFoundExceptiontypeName requires a dependent assembly that could not be found.
T:System.IO.FileLoadExceptiontypeName requires a dependent assembly that was found but could not be loaded.-or-The current assembly was loaded into the reflection-only context, and typeName requires a dependent assembly that was not preloaded.
T:System.BadImageFormatExceptiontypeName requires a dependent assembly, but the file is not a valid assembly. -or- typeName requires a dependent assembly that was compiled for a version of the runtime that is later than the currently loaded version.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1130 of file Assembly.cs.

◆ CreateInstance() [2/3]

object System.Reflection.Assembly.CreateInstance ( string  typeName,
bool  ignoreCase 
)

Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search.

Parameters
typeNameThe P:System.Type.FullName of the type to locate.
ignoreCasetrue to ignore the case of the type name; otherwise, false.
Returns
An instance of the specified type created with the default constructor; or null if typeName is not found. The type is resolved using the default binder, without specifying culture or activation attributes, and with T:System.Reflection.BindingFlags set to Public or Instance.
Exceptions
T:System.ArgumentExceptiontypeName is an empty string ("") or a string beginning with a null character. -or-The current assembly was loaded into the reflection-only context.
T:System.MissingMethodExceptionNo matching constructor was found.
T:System.ArgumentNullExceptiontypeName is null.
T:System.IO.FileNotFoundExceptiontypeName requires a dependent assembly that could not be found.
T:System.IO.FileLoadExceptiontypeName requires a dependent assembly that was found but could not be loaded.-or-The current assembly was loaded into the reflection-only context, and typeName requires a dependent assembly that was not preloaded.
T:System.BadImageFormatExceptiontypeName requires a dependent assembly, but the file is not a valid assembly. -or- typeName requires a dependent assembly that was compiled for a version of the runtime that is later than the currently loaded version.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1152 of file Assembly.cs.

◆ CreateInstance() [3/3]

virtual object System.Reflection.Assembly.CreateInstance ( string  typeName,
bool  ignoreCase,
BindingFlags  bindingAttr,
Binder  binder,
object []  args,
CultureInfo  culture,
object []  activationAttributes 
)
virtual

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.

Parameters
typeNameThe P:System.Type.FullName of the type to locate.
ignoreCasetrue to ignore the case of the type name; otherwise, false.
bindingAttrA bitmask that affects the way in which the search is conducted. The value is a combination of bit flags from T:System.Reflection.BindingFlags.
binderAn object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects via reflection. If binder is null, the default binder is used.
argsAn 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 default constructor is desired, args must be an empty array or null.
cultureAn instance of CultureInfo used to govern the coercion of types. If this is null, the CultureInfo for the current thread is used. (This is necessary to convert a String that represents 1000 to a Double value, for example, since 1000 is represented differently by different cultures.)
activationAttributesAn array of one or more attributes that can participate in activation. Typically, an array that contains a single 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 null if 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.
Exceptions
T:System.ArgumentExceptiontypeName is an empty string ("") or a string beginning with a null character. -or-The current assembly was loaded into the reflection-only context.
T:System.ArgumentNullExceptiontypeName is null.
T:System.MissingMethodExceptionNo matching constructor was found.
T:System.NotSupportedExceptionA non-empty activation attributes array is passed to a type that does not inherit from T:System.MarshalByRefObject.
T:System.IO.FileNotFoundExceptiontypeName requires a dependent assembly that could not be found.
T:System.IO.FileLoadExceptiontypeName requires a dependent assembly that was found but could not be loaded.-or-The current assembly was loaded into the reflection-only context, and typeName requires a dependent assembly that was not preloaded.
T:System.BadImageFormatExceptiontypeName requires a dependent assembly, but the file is not a valid assembly. -or- typeName requires a dependent assembly which that was compiled for a version of the runtime that is later than the currently loaded version.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1180 of file Assembly.cs.

◆ CreateQualifiedName()

static string System.Reflection.Assembly.CreateQualifiedName ( string  assemblyName,
string  typeName 
)
static

Creates the name of a type qualified by the display name of its assembly.

Parameters
assemblyNameThe display name of an assembly.
typeNameThe full name of a type.
Returns
The full name of the type qualified by the display name of the assembly.

Definition at line 282 of file Assembly.cs.

◆ Equals()

override bool System.Reflection.Assembly.Equals ( object  o)

Determines whether this assembly and the specified object are equal.

Parameters
oThe object to compare with this instance.
Returns
true if o is equal to this instance; otherwise, false.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 341 of file Assembly.cs.

◆ GetAssembly()

static Assembly System.Reflection.Assembly.GetAssembly ( Type  type)
static

Gets the currently loaded assembly in which the specified type is defined.

Parameters
typeAn object representing a type in the assembly that will be returned.
Returns
The assembly in which the specified type is defined.
Exceptions
T:System.ArgumentNullExceptiontype is null.

Definition at line 292 of file Assembly.cs.

◆ GetCallingAssembly()

static Assembly System.Reflection.Assembly.GetCallingAssembly ( )
static

Returns the T:System.Reflection.Assembly of the method that invoked the currently executing method.

Returns
The Assembly object of the method that invoked the currently executing method.

Definition at line 810 of file Assembly.cs.

◆ GetCustomAttributes() [1/2]

virtual object [] System.Reflection.Assembly.GetCustomAttributes ( bool  inherit)
virtual

Gets all the custom attributes for this assembly.

Parameters
inheritThis argument is ignored for objects of type T:System.Reflection.Assembly.
Returns
An array that contains the custom attributes for this assembly.

Implements System.Reflection.ICustomAttributeProvider.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1041 of file Assembly.cs.

◆ GetCustomAttributes() [2/2]

virtual object [] System.Reflection.Assembly.GetCustomAttributes ( Type  attributeType,
bool  inherit 
)
virtual

Gets the custom attributes for this assembly as specified by type.

Parameters
attributeTypeThe type for which the custom attributes are to be returned.
inheritThis argument is ignored for objects of type T:System.Reflection.Assembly.
Returns
An array that contains the custom attributes for this assembly as specified by attributeType .
Exceptions
T:System.ArgumentNullExceptionattributeType is null.
T:System.ArgumentExceptionattributeType is not a runtime type.

Implements System.Reflection.ICustomAttributeProvider.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1055 of file Assembly.cs.

◆ GetCustomAttributesData()

virtual IList<CustomAttributeData> System.Reflection.Assembly.GetCustomAttributesData ( )
virtual

Returns information about the attributes that have been applied to the current T:System.Reflection.Assembly, expressed as T:System.Reflection.CustomAttributeData objects.

Returns
A generic list of T:System.Reflection.CustomAttributeData objects representing data about the attributes that have been applied to the current assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1077 of file Assembly.cs.

◆ GetEntryAssembly()

static Assembly System.Reflection.Assembly.GetEntryAssembly ( )
static

Gets the process executable in the default application domain. In other application domains, this is the first executable that was executed by M:System.AppDomain.ExecuteAssembly(System.String).

Returns
The assembly that is the process executable in the default application domain, or the first executable that was executed by M:System.AppDomain.ExecuteAssembly(System.String). Can return null when called from unmanaged code.

Definition at line 819 of file Assembly.cs.

◆ GetExecutingAssembly()

static Assembly System.Reflection.Assembly.GetExecutingAssembly ( )
static

Gets the assembly that contains the code that is currently executing.

Returns
The assembly that contains the code that is currently executing.

Definition at line 799 of file Assembly.cs.

◆ GetExportedTypes()

virtual Type [] System.Reflection.Assembly.GetExportedTypes ( )
virtual

Gets the public types defined in this assembly that are visible outside the assembly.

Returns
An array that represents the types defined in this assembly that are visible outside the assembly.
Exceptions
T:System.NotSupportedExceptionThe assembly is a dynamic assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 932 of file Assembly.cs.

◆ GetFile()

virtual FileStream System.Reflection.Assembly.GetFile ( string  name)
virtual

Gets a T:System.IO.FileStream for the specified file in the file table of the manifest of this assembly.

Parameters
nameThe name of the specified file. Do not include the path to the file.
Returns
A stream that contains the specified file, or null if the file is not found.
Exceptions
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.ArgumentNullExceptionThe name parameter is null.
T:System.ArgumentExceptionThe name parameter is an empty string ("").
T:System.IO.FileNotFoundExceptionname was not found.
T:System.BadImageFormatExceptionname is not a valid assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1249 of file Assembly.cs.

◆ GetFiles() [1/2]

virtual FileStream [] System.Reflection.Assembly.GetFiles ( )
virtual

Gets the files in the file table of an assembly manifest.

Returns
An array of streams that contain the files.
Exceptions
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.IO.FileNotFoundExceptionA file was not found.
T:System.BadImageFormatExceptionA file was not a valid assembly.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1259 of file Assembly.cs.

◆ GetFiles() [2/2]

virtual FileStream [] System.Reflection.Assembly.GetFiles ( bool  getResourceModules)
virtual

Gets the files in the file table of an assembly manifest, specifying whether to include resource modules.

Parameters
getResourceModulestrue to include resource modules; otherwise, false.
Returns
An array of streams that contain the files.
Exceptions
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.IO.FileNotFoundExceptionA file was not found.
T:System.BadImageFormatExceptionA file was not a valid assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1271 of file Assembly.cs.

◆ GetHashCode()

override int System.Reflection.Assembly.GetHashCode ( )

Returns the hash code for this instance.

Returns
A 32-bit signed integer hash code.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 349 of file Assembly.cs.

◆ GetLoadedModules() [1/2]

Module [] System.Reflection.Assembly.GetLoadedModules ( )

Gets all the loaded modules that are part of this assembly.

Returns
An array of modules.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1192 of file Assembly.cs.

◆ GetLoadedModules() [2/2]

virtual Module [] System.Reflection.Assembly.GetLoadedModules ( bool  getResourceModules)
virtual

Gets all the loaded modules that are part of this assembly, specifying whether to include resource modules.

Parameters
getResourceModulestrue to include resource modules; otherwise, false.
Returns
An array of modules.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1201 of file Assembly.cs.

◆ GetManifestResourceInfo()

virtual ManifestResourceInfo System.Reflection.Assembly.GetManifestResourceInfo ( string  resourceName)
virtual

Returns information about how the given resource has been persisted.

Parameters
resourceNameThe case-sensitive name of the resource.
Returns
An object that is populated with information about the resource's topology, or null if the resource is not found.
Exceptions
T:System.ArgumentNullExceptionresourceName is null.
T:System.ArgumentExceptionThe resourceName parameter is an empty string ("").

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1298 of file Assembly.cs.

◆ GetManifestResourceNames()

virtual string [] System.Reflection.Assembly.GetManifestResourceNames ( )
virtual

Returns the names of all the resources in this assembly.

Returns
An array that contains the names of all the resources.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1279 of file Assembly.cs.

◆ GetManifestResourceStream() [1/2]

virtual Stream System.Reflection.Assembly.GetManifestResourceStream ( Type  type,
string  name 
)
virtual

Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly.

Parameters
typeThe type whose namespace is used to scope the manifest resource name.
nameThe case-sensitive name of the manifest resource being requested.
Returns
The manifest resource; or null if no resources were specified during compilation or if the resource is not visible to the caller.
Exceptions
T:System.ArgumentNullExceptionThe name parameter is null.
T:System.ArgumentExceptionThe name parameter is an empty string ("").
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.IO.FileNotFoundExceptionname was not found.
T:System.BadImageFormatExceptionname is not a valid assembly.
T:System.NotImplementedExceptionResource length is greater than F:System.Int64.MaxValue.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 976 of file Assembly.cs.

◆ GetManifestResourceStream() [2/2]

virtual Stream System.Reflection.Assembly.GetManifestResourceStream ( string  name)
virtual

Loads the specified manifest resource from this assembly.

Parameters
nameThe case-sensitive name of the manifest resource being requested.
Returns
The manifest resource; or null if no resources were specified during compilation or if the resource is not visible to the caller.
Exceptions
T:System.ArgumentNullExceptionThe name parameter is null.
T:System.ArgumentExceptionThe name parameter is an empty string ("").
T:System.IO.FileLoadExceptionIn the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.IO.IOException, instead.A file that was found could not be loaded.
T:System.IO.FileNotFoundExceptionname was not found.
T:System.BadImageFormatExceptionname is not a valid assembly.
T:System.NotImplementedExceptionResource length is greater than F:System.Int64.MaxValue.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 994 of file Assembly.cs.

◆ GetModule()

virtual Module System.Reflection.Assembly.GetModule ( string  name)
virtual

Gets the specified module in this assembly.

Parameters
nameThe name of the module being requested.
Returns
The module being requested, or null if the module is not found.
Exceptions
T:System.ArgumentNullExceptionThe name parameter is null.
T:System.ArgumentExceptionThe name parameter is an empty string ("").
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.IO.FileNotFoundExceptionname was not found.
T:System.BadImageFormatExceptionname is not a valid assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1234 of file Assembly.cs.

◆ GetModules() [1/2]

Module [] System.Reflection.Assembly.GetModules ( )

Gets all the modules that are part of this assembly.

Returns
An array of modules.
Exceptions
T:System.IO.FileNotFoundExceptionThe module to be loaded does not specify a file name extension.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1210 of file Assembly.cs.

◆ GetModules() [2/2]

virtual Module [] System.Reflection.Assembly.GetModules ( bool  getResourceModules)
virtual

Gets all the modules that are part of this assembly, specifying whether to include resource modules.

Parameters
getResourceModulestrue to include resource modules; otherwise, false.
Returns
An array of modules.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1219 of file Assembly.cs.

◆ GetName() [1/2]

virtual AssemblyName System.Reflection.Assembly.GetName ( )
virtual

Gets an T:System.Reflection.AssemblyName for this assembly.

Returns
An object that contains the fully parsed display name for this assembly.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 832 of file Assembly.cs.

◆ GetName() [2/2]

virtual AssemblyName System.Reflection.Assembly.GetName ( bool  copiedName)
virtual

Gets an T:System.Reflection.AssemblyName for this assembly, setting the codebase as specified by copiedName .

Parameters
copiedNametrue to set the P:System.Reflection.Assembly.CodeBase to the location of the assembly after it was shadow copied; false to set P:System.Reflection.Assembly.CodeBase to the original location.
Returns
An object that contains the fully parsed display name for this assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 841 of file Assembly.cs.

◆ GetObjectData()

virtual void System.Reflection.Assembly.GetObjectData ( SerializationInfo  info,
StreamingContext  context 
)
virtual

Gets serialization information with all of the data needed to reinstantiate this assembly.

Parameters
infoThe object to be populated with serialization information.
contextThe destination context of the serialization.
Exceptions
T:System.ArgumentNullExceptioninfo is null.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1032 of file Assembly.cs.

◆ GetReferencedAssemblies()

virtual AssemblyName [] System.Reflection.Assembly.GetReferencedAssemblies ( )
virtual

Gets the T:System.Reflection.AssemblyName objects for all the assemblies referenced by this assembly.

Returns
An array that contains the fully parsed display names of all the assemblies referenced by this assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1286 of file Assembly.cs.

◆ GetSatelliteAssembly() [1/2]

virtual Assembly System.Reflection.Assembly.GetSatelliteAssembly ( CultureInfo  culture)
virtual

Gets the satellite assembly for the specified culture.

Parameters
cultureThe specified culture.
Returns
The specified satellite assembly.
Exceptions
T:System.ArgumentNullExceptionculture is null.
T:System.IO.FileNotFoundExceptionThe assembly cannot be found.
T:System.IO.FileLoadExceptionThe satellite assembly with a matching file name was found, but the CultureInfo did not match the one specified.
T:System.BadImageFormatExceptionThe satellite assembly is not a valid assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1007 of file Assembly.cs.

◆ GetSatelliteAssembly() [2/2]

virtual Assembly System.Reflection.Assembly.GetSatelliteAssembly ( CultureInfo  culture,
Version  version 
)
virtual

Gets the specified version of the satellite assembly for the specified culture.

Parameters
cultureThe specified culture.
versionThe version of the satellite assembly.
Returns
The specified satellite assembly.
Exceptions
T:System.ArgumentNullExceptionculture is null.
T:System.IO.FileLoadExceptionThe satellite assembly with a matching file name was found, but the CultureInfo or the version did not match the one specified.
T:System.IO.FileNotFoundExceptionThe assembly cannot be found.
T:System.BadImageFormatExceptionThe satellite assembly is not a valid assembly.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1021 of file Assembly.cs.

◆ GetType() [1/3]

virtual Type System.Reflection.Assembly.GetType ( string  name)
virtual

Gets the T:System.Type object with the specified name in the assembly instance.

Parameters
nameThe full name of the type.
Returns
An object that represents the specified class, or null if the class is not found.
Exceptions
T:System.ArgumentExceptionname is invalid.
T:System.ArgumentNullExceptionname is null.
T:System.IO.FileNotFoundExceptionname

requires a dependent assembly that could not be found.

Exceptions
T:System.IO.FileLoadExceptionIn the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.IO.IOException, instead. name requires a dependent assembly that was found but could not be loaded.-or-The current assembly was loaded into the reflection-only context, and name requires a dependent assembly that was not preloaded.
T:System.BadImageFormatExceptionname requires a dependent assembly, but the file is not a valid assembly. -or- name requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 871 of file Assembly.cs.

◆ GetType() [2/3]

virtual Type System.Reflection.Assembly.GetType ( string  name,
bool  throwOnError 
)
virtual

Gets the T:System.Type object with the specified name in the assembly instance and optionally throws an exception if the type is not found.

Parameters
nameThe full name of the type.
throwOnErrortrue to throw an exception if the type is not found; false to return null.
Returns
An object that represents the specified class.
Exceptions
T:System.ArgumentExceptionname is invalid.-or- The length of name exceeds 1024 characters.
T:System.ArgumentNullExceptionname is null.
T:System.TypeLoadExceptionthrowOnError is true, and the type cannot be found.
T:System.IO.FileNotFoundExceptionname requires a dependent assembly that could not be found.
T:System.IO.FileLoadExceptionname requires a dependent assembly that was found but could not be loaded.-or-The current assembly was loaded into the reflection-only context, and name requires a dependent assembly that was not preloaded.
T:System.BadImageFormatExceptionname requires a dependent assembly, but the file is not a valid assembly. -or- name requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 895 of file Assembly.cs.

◆ GetType() [3/3]

virtual Type System.Reflection.Assembly.GetType ( string  name,
bool  throwOnError,
bool  ignoreCase 
)
virtual

Gets the 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.

Parameters
nameThe full name of the type.
throwOnErrortrue to throw an exception if the type is not found; false to return null.
ignoreCasetrue to ignore the case of the type name; otherwise, false.
Returns
An object that represents the specified class.
Exceptions
T:System.ArgumentExceptionname is invalid.-or- The length of name exceeds 1024 characters.
T:System.ArgumentNullExceptionname is null.
T:System.TypeLoadExceptionthrowOnError is true, and the type cannot be found.
T:System.IO.FileNotFoundExceptionname

requires a dependent assembly that could not be found.

Exceptions
T:System.IO.FileLoadExceptionname requires a dependent assembly that was found but could not be loaded.-or-The current assembly was loaded into the reflection-only context, and name requires a dependent assembly that was not preloaded.
T:System.BadImageFormatExceptionname requires a dependent assembly, but the file is not a valid assembly. -or- name requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version.

Implements System.Runtime.InteropServices._Assembly.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 923 of file Assembly.cs.

◆ GetTypes()

virtual Type [] System.Reflection.Assembly.GetTypes ( )
virtual

Gets the types defined in this assembly.

Returns
An array that contains all the types that are defined in this assembly.
Exceptions
T:System.Reflection.ReflectionTypeLoadExceptionThe assembly contains one or more types that cannot be loaded. The array returned by the P:System.Reflection.ReflectionTypeLoadException.Types property of this exception contains a T:System.Type object for each type that was loaded and null for each type that could not be loaded, while the P:System.Reflection.ReflectionTypeLoadException.LoaderExceptions property contains an exception for each type that could not be loaded.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 941 of file Assembly.cs.

◆ IsDefined()

virtual bool System.Reflection.Assembly.IsDefined ( Type  attributeType,
bool  inherit 
)
virtual

Indicates whether or not a specified attribute has been applied to the assembly.

Parameters
attributeTypeThe type of the attribute to be checked for this assembly.
inheritThis argument is ignored for objects of this type.
Returns
true if the attribute has been applied to the assembly; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionattributeType is null.
T:System.ArgumentExceptionattributeType uses an invalid type.

Implements System.Reflection.ICustomAttributeProvider.

Reimplemented in System.Reflection.Emit.AssemblyBuilder.

Definition at line 1070 of file Assembly.cs.

◆ Load() [1/8]

static Assembly System.Reflection.Assembly.Load ( string  assemblyString)
static

Loads an assembly given the long form of its name.

Parameters
assemblyStringThe long form of the assembly name.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyString is null.
T:System.ArgumentExceptionassemblyString is a zero-length string.
T:System.IO.FileNotFoundExceptionassemblyString is not found.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.BadImageFormatExceptionassemblyString is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyString was compiled with a later version.

Definition at line 507 of file Assembly.cs.

◆ Load() [2/8]

static Assembly System.Reflection.Assembly.Load ( string  assemblyString,
Evidence  assemblySecurity 
)
static

Loads an assembly given its display name, loading the assembly into the domain of the caller using the supplied evidence.

Parameters
assemblyStringThe display name of the assembly.
assemblySecurityEvidence for loading the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyString is null.
T:System.IO.FileNotFoundExceptionassemblyString is not found.
T:System.BadImageFormatExceptionassemblyString is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyString was compiled with a later version.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.-or-An assembly or module was loaded twice with two different evidences.

Definition at line 566 of file Assembly.cs.

◆ Load() [3/8]

static Assembly System.Reflection.Assembly.Load ( AssemblyName  assemblyRef)
static

Loads an assembly given its T:System.Reflection.AssemblyName.

Parameters
assemblyRefThe object that describes the assembly to be loaded.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyRef is null.
T:System.IO.FileNotFoundExceptionassemblyRef is not found.
T:System.IO.FileLoadExceptionIn the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.IO.IOException, instead.A file that was found could not be loaded.
T:System.BadImageFormatExceptionassemblyRef is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyRef was compiled with a later version.

Definition at line 586 of file Assembly.cs.

◆ Load() [4/8]

static Assembly System.Reflection.Assembly.Load ( AssemblyName  assemblyRef,
Evidence  assemblySecurity 
)
static

Loads an assembly given its T:System.Reflection.AssemblyName. The assembly is loaded into the domain of the caller using the supplied evidence.

Parameters
assemblyRefThe object that describes the assembly to be loaded.
assemblySecurityEvidence for loading the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyRef is null.
T:System.IO.FileNotFoundExceptionassemblyRef is not found.
T:System.BadImageFormatExceptionassemblyRef is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyRef was compiled with a later version.
T:System.IO.FileLoadExceptionAn assembly or module was loaded twice with two different evidences.

Definition at line 606 of file Assembly.cs.

◆ Load() [5/8]

static Assembly System.Reflection.Assembly.Load ( byte []  rawAssembly)
static

Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the application domain of the caller.

Parameters
rawAssemblyA byte array that is a COFF-based image containing an emitted assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionrawAssembly is null.
T:System.BadImageFormatExceptionrawAssembly is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and rawAssembly was compiled with a later version.

Definition at line 653 of file Assembly.cs.

◆ Load() [6/8]

static Assembly System.Reflection.Assembly.Load ( byte []  rawAssembly,
byte []  rawSymbolStore 
)
static

Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols for the assembly. The assembly is loaded into the application domain of the caller.

Parameters
rawAssemblyA byte array that is a COFF-based image containing an emitted assembly.
rawSymbolStoreA byte array that contains the raw bytes representing the symbols for the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionrawAssembly is null.
T:System.BadImageFormatExceptionrawAssembly is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and rawAssembly was compiled with a later version.

Definition at line 688 of file Assembly.cs.

◆ Load() [7/8]

static Assembly System.Reflection.Assembly.Load ( byte []  rawAssembly,
byte []  rawSymbolStore,
SecurityContextSource  securityContextSource 
)
static

Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and specifying the source for the security context. The assembly is loaded into the application domain of the caller.

Parameters
rawAssemblyA byte array that is a COFF-based image containing an emitted assembly.
rawSymbolStoreA byte array that contains the raw bytes representing the symbols for the assembly.
securityContextSourceThe source of the security context.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionrawAssembly is null.
T:System.BadImageFormatExceptionrawAssembly is not a valid assembly. -or- rawAssembly was compiled with a later version of the common language runtime than the version that is currently loaded.
T:System.ArgumentOutOfRangeExceptionThe value of securityContextSource is not one of the enumeration values.

Definition at line 709 of file Assembly.cs.

◆ Load() [8/8]

static Assembly System.Reflection.Assembly.Load ( byte []  rawAssembly,
byte []  rawSymbolStore,
Evidence  securityEvidence 
)
static

Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols and evidence for the assembly. The assembly is loaded into the application domain of the caller.

Parameters
rawAssemblyA byte array that is a COFF-based image containing an emitted assembly.
rawSymbolStoreA byte array that contains the raw bytes representing the symbols for the assembly.
securityEvidenceEvidence for loading the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionrawAssembly is null.
T:System.BadImageFormatExceptionrawAssembly is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and rawAssembly was compiled with a later version.
T:System.IO.FileLoadExceptionAn assembly or module was loaded twice with two different evidences.
T:System.NotSupportedExceptionsecurityEvidence is not null. By default, legacy CAS policy is not enabled in the .NET Framework 4; when it is not enabled, securityEvidence  must be null.

Definition at line 736 of file Assembly.cs.

◆ LoadFile() [1/2]

static Assembly System.Reflection.Assembly.LoadFile ( string  path)
static

Loads the contents of an assembly file on the specified path.

Parameters
pathThe fully qualified path of the file to load.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentExceptionThe path argument is not an absolute path.
T:System.ArgumentNullExceptionThe path parameter is null.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.IO.FileNotFoundExceptionThe path parameter is an empty string ("") or does not exist.
T:System.BadImageFormatExceptionpath is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and path was compiled with a later version.

Definition at line 761 of file Assembly.cs.

◆ LoadFile() [2/2]

static Assembly System.Reflection.Assembly.LoadFile ( string  path,
Evidence  securityEvidence 
)
static

Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence.

Parameters
pathThe fully qualified path of the assembly file.
securityEvidenceEvidence for loading the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentExceptionThe path argument is not an absolute path.
T:System.ArgumentNullExceptionThe path parameter is null.
T:System.IO.FileNotFoundExceptionThe path parameter is an empty string ("") or does not exist.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.BadImageFormatExceptionpath is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and path was compiled with a later version.
T:System.NotSupportedExceptionsecurityEvidence is not null. By default, legacy CAS policy is not enabled in the .NET Framework 4; when it is not enabled, securityEvidence  must be null.

Definition at line 783 of file Assembly.cs.

◆ LoadFrom() [1/4]

static Assembly System.Reflection.Assembly.LoadFrom ( string  assemblyFile)
static

Loads an assembly given its file name or path.

Parameters
assemblyFileThe name or path of the file that contains the manifest of the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyFile is null.
T:System.IO.FileNotFoundExceptionassemblyFile is not found, or the module you are trying to load does not specify a filename extension.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyFile was compiled with a later version.
T:System.Security.SecurityExceptionA codebase that does not start with "file://" was specified without the required T:System.Net.WebPermission.
T:System.ArgumentExceptionThe assemblyFile parameter is an empty string ("").
T:System.IO.PathTooLongExceptionThe assembly name is longer than MAX_PATH characters.

Definition at line 369 of file Assembly.cs.

◆ LoadFrom() [2/4]

static Assembly System.Reflection.Assembly.LoadFrom ( string  assemblyFile,
Evidence  securityEvidence 
)
static

Loads an assembly given its file name or path and supplying security evidence.

Parameters
assemblyFileThe name or path of the file that contains the manifest of the assembly.
securityEvidenceEvidence for loading the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyFile is null.
T:System.IO.FileNotFoundExceptionassemblyFile is not found, or the module you are trying to load does not specify a filename extension.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.-or-The securityEvidence is not ambiguous and is determined to be invalid.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyFile was compiled with a later version.
T:System.Security.SecurityExceptionA codebase that does not start with "file://" was specified without the required T:System.Net.WebPermission.
T:System.ArgumentExceptionThe assemblyFile parameter is an empty string ("").
T:System.IO.PathTooLongExceptionThe assembly name is longer than MAX_PATH characters.

Definition at line 415 of file Assembly.cs.

◆ LoadFrom() [3/4]

static Assembly System.Reflection.Assembly.LoadFrom ( string  assemblyFile,
Evidence  securityEvidence,
byte []  hashValue,
AssemblyHashAlgorithm  hashAlgorithm 
)
static

Loads an assembly given its file name or path, security evidence, hash value, and hash algorithm.

Parameters
assemblyFileThe name or path of the file that contains the manifest of the assembly.
securityEvidenceEvidence for loading the assembly.
hashValueThe value of the computed hash code.
hashAlgorithmThe hash algorithm used for hashing files and for generating the strong name.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyFile is null.
T:System.IO.FileNotFoundExceptionassemblyFile is not found, or the module you are trying to load does not specify a filename extension.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.-or-The securityEvidence is not ambiguous and is determined to be invalid.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyFile was compiled with a later version.
T:System.Security.SecurityExceptionA codebase that does not start with "file://" was specified without the required T:System.Net.WebPermission.
T:System.ArgumentExceptionThe assemblyFile parameter is an empty string ("").
T:System.IO.PathTooLongExceptionThe assembly name is longer than MAX_PATH characters.

Definition at line 440 of file Assembly.cs.

◆ LoadFrom() [4/4]

static Assembly System.Reflection.Assembly.LoadFrom ( string  assemblyFile,
byte []  hashValue,
AssemblyHashAlgorithm  hashAlgorithm 
)
static

Loads an assembly given its file name or path, hash value, and hash algorithm.

Parameters
assemblyFileThe name or path of the file that contains the manifest of the assembly.
hashValueThe value of the computed hash code.
hashAlgorithmThe hash algorithm used for hashing files and for generating the strong name.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyFile is null.
T:System.IO.FileNotFoundExceptionassemblyFile is not found, or the module you are trying to load does not specify a file name extension.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly; for example, a 32-bit assembly in a 64-bit process. See the exception topic for more information. -or- assemblyFile was compiled with a later version of the common language runtime than the version that is currently loaded.
T:System.Security.SecurityExceptionA codebase that does not start with "file://" was specified without the required T:System.Net.WebPermission.
T:System.ArgumentExceptionThe assemblyFile parameter is an empty string ("").
T:System.IO.PathTooLongExceptionThe assembly name is longer than MAX_PATH characters.

Definition at line 464 of file Assembly.cs.

◆ LoadModule() [1/2]

Module System.Reflection.Assembly.LoadModule ( string  moduleName,
byte []  rawModule 
)

Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file.

Parameters
moduleNameThe name of the module. This string must correspond to a file name in this assembly's manifest.
rawModuleA byte array that is a COFF-based image containing an emitted module, or a resource.
Returns
The loaded module.
Exceptions
T:System.ArgumentNullExceptionmoduleName or rawModule is null.
T:System.ArgumentExceptionmoduleName does not match a file entry in this assembly's manifest.
T:System.BadImageFormatExceptionrawModule is not a valid module.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1093 of file Assembly.cs.

◆ LoadModule() [2/2]

virtual Module System.Reflection.Assembly.LoadModule ( string  moduleName,
byte []  rawModule,
byte []  rawSymbolStore 
)
virtual

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.

Parameters
moduleNameThe name of the module. This string must correspond to a file name in this assembly's manifest.
rawModuleA byte array that is a COFF-based image containing an emitted module, or a resource.
rawSymbolStoreA byte array containing the raw bytes representing the symbols for the module. Must be null if this is a resource file.
Returns
The loaded module.
Exceptions
T:System.ArgumentNullExceptionmoduleName or rawModule is null.
T:System.ArgumentExceptionmoduleName does not match a file entry in this assembly's manifest.
T:System.BadImageFormatExceptionrawModule is not a valid module.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1110 of file Assembly.cs.

◆ LoadWithPartialName() [1/2]

static Assembly System.Reflection.Assembly.LoadWithPartialName ( string  partialName)
static

Loads an assembly from the application directory or from the global assembly cache using a partial name.

Parameters
partialNameThe display name of the assembly.
Returns
The loaded assembly. If partialName is not found, this method returns null.
Exceptions
T:System.ArgumentNullExceptionThe partialName parameter is null.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and partialName was compiled with a later version.

Definition at line 621 of file Assembly.cs.

◆ LoadWithPartialName() [2/2]

static Assembly System.Reflection.Assembly.LoadWithPartialName ( string  partialName,
Evidence  securityEvidence 
)
static

Loads an assembly from the application directory or from the global assembly cache using a partial name. The assembly is loaded into the domain of the caller using the supplied evidence.

Parameters
partialNameThe display name of the assembly.
securityEvidenceEvidence for loading the assembly.
Returns
The loaded assembly. If partialName is not found, this method returns null.
Exceptions
T:System.IO.FileLoadExceptionAn assembly or module was loaded twice with two different sets of evidence.
T:System.ArgumentNullExceptionThe partialName parameter is null.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and partialName was compiled with a later version.

Definition at line 638 of file Assembly.cs.

◆ operator !=()

static bool System.Reflection.Assembly.operator != ( Assembly  left,
Assembly  right 
)
static

Indicates whether two T:System.Reflection.Assembly objects are not equal.

Parameters
leftThe assembly to compare to right .
rightThe assembly to compare to left .
Returns
true if left is not equal to right ; otherwise, false.

Definition at line 331 of file Assembly.cs.

◆ operator==()

static bool System.Reflection.Assembly.operator== ( Assembly  left,
Assembly  right 
)
static

Indicates whether two T:System.Reflection.Assembly objects are equal.

Parameters
leftThe assembly to compare to right .
rightThe assembly to compare to left .
Returns
true if left is equal to right ; otherwise, false.

Definition at line 312 of file Assembly.cs.

◆ ReflectionOnlyLoad() [1/2]

static Assembly System.Reflection.Assembly.ReflectionOnlyLoad ( string  assemblyString)
static

Loads an assembly into the reflection-only context, given its display name.

Parameters
assemblyStringThe display name of the assembly, as returned by the P:System.Reflection.AssemblyName.FullName property.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyString is null.
T:System.ArgumentExceptionassemblyString is an empty string ("").
T:System.IO.FileNotFoundExceptionassemblyString is not found.
T:System.IO.FileLoadExceptionassemblyString is found, but cannot be loaded.
T:System.BadImageFormatExceptionassemblyString is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyString was compiled with a later version.

Definition at line 546 of file Assembly.cs.

◆ ReflectionOnlyLoad() [2/2]

static Assembly System.Reflection.Assembly.ReflectionOnlyLoad ( byte []  rawAssembly)
static

Loads the assembly from a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the reflection-only context of the caller's application domain.

Parameters
rawAssemblyA byte array that is a COFF-based image containing an emitted assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionrawAssembly is null.
T:System.BadImageFormatExceptionrawAssembly is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and rawAssembly was compiled with a later version.
T:System.IO.FileLoadExceptionrawAssembly cannot be loaded.

Definition at line 671 of file Assembly.cs.

◆ ReflectionOnlyLoadFrom()

static Assembly System.Reflection.Assembly.ReflectionOnlyLoadFrom ( string  assemblyFile)
static

Loads an assembly into the reflection-only context, given its path.

Parameters
assemblyFileThe path of the file that contains the manifest of the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyFile is null.
T:System.IO.FileNotFoundExceptionassemblyFile is not found, or the module you are trying to load does not specify a file name extension.
T:System.IO.FileLoadExceptionassemblyFile is found, but could not be loaded.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly. -or-Version 2.0 or later of the common language runtime is currently loaded and assemblyFile was compiled with a later version.
T:System.Security.SecurityExceptionA codebase that does not start with "file://" was specified without the required T:System.Net.WebPermission.
T:System.IO.PathTooLongExceptionThe assembly name is longer than MAX_PATH characters.
T:System.ArgumentExceptionassemblyFile is an empty string ("").

Definition at line 392 of file Assembly.cs.

◆ ToString()

override string System.Reflection.Assembly.ToString ( )

Returns the full name of the assembly, also known as the display name.

Returns
The full name of the assembly, or the class name if the full name of the assembly cannot be determined.

Implements System.Runtime.InteropServices._Assembly.

Definition at line 1306 of file Assembly.cs.

◆ UnsafeLoadFrom()

static Assembly System.Reflection.Assembly.UnsafeLoadFrom ( string  assemblyFile)
static

Loads an assembly into the load-from context, bypassing some security checks.

Parameters
assemblyFileThe name or path of the file that contains the manifest of the assembly.
Returns
The loaded assembly.
Exceptions
T:System.ArgumentNullExceptionassemblyFile is null.
T:System.IO.FileNotFoundExceptionassemblyFile is not found, or the module you are trying to load does not specify a filename extension.
T:System.IO.FileLoadExceptionA file that was found could not be loaded.
T:System.BadImageFormatExceptionassemblyFile is not a valid assembly. -or- assemblyFile was compiled with a later version of the common language runtime than the version that is currently loaded.
T:System.Security.SecurityExceptionA codebase that does not start with "file://" was specified without the required T:System.Net.WebPermission.
T:System.ArgumentExceptionThe assemblyFile parameter is an empty string ("").
T:System.IO.PathTooLongExceptionThe assembly name is longer than MAX_PATH characters.

Definition at line 486 of file Assembly.cs.

Property Documentation

◆ CodeBase

virtual string System.Reflection.Assembly.CodeBase
get

Gets the location of the assembly as specified originally, for example, in an T:System.Reflection.AssemblyName object.

Returns
The location of the assembly as specified originally.

Definition at line 27 of file Assembly.cs.

◆ CustomAttributes

virtual IEnumerable<CustomAttributeData> System.Reflection.Assembly.CustomAttributes
get

Gets a collection that contains this assembly's custom attributes.

Returns
A collection that contains this assembly's custom attributes.

Definition at line 169 of file Assembly.cs.

◆ DefinedTypes

virtual IEnumerable<TypeInfo> System.Reflection.Assembly.DefinedTypes
get

Gets a collection of the types defined in this assembly.

Returns
A collection of the types defined in this assembly.

Definition at line 85 of file Assembly.cs.

◆ EntryPoint

virtual MethodInfo System.Reflection.Assembly.EntryPoint
get

Gets the entry point of this assembly.

Returns
An object that represents the entry point of this assembly. If no entry point is found (for example, the assembly is a DLL), null is returned.

Definition at line 61 of file Assembly.cs.

◆ EscapedCodeBase

virtual string System.Reflection.Assembly.EscapedCodeBase
get

Gets the URI, including escape characters, that represents the codebase.

Returns
A URI with escape characters.

Definition at line 37 of file Assembly.cs.

◆ Evidence

virtual Evidence System.Reflection.Assembly.Evidence
get

Gets the evidence for this assembly.

Returns
The evidence for this assembly.

Definition at line 107 of file Assembly.cs.

◆ ExportedTypes

virtual IEnumerable<Type> System.Reflection.Assembly.ExportedTypes
get

Gets a collection of the public types defined in this assembly that are visible outside the assembly.

Returns
A collection of the public types defined in this assembly that are visible outside the assembly.

Definition at line 73 of file Assembly.cs.

◆ FullName

virtual string System.Reflection.Assembly.FullName
get

Gets the display name of the assembly.

Returns
The display name of the assembly.

Definition at line 49 of file Assembly.cs.

◆ GlobalAssemblyCache

virtual bool System.Reflection.Assembly.GlobalAssemblyCache
get

Gets a value indicating whether the assembly was loaded from the global assembly cache.

Returns
true if the assembly was loaded from the global assembly cache; otherwise, false.

Definition at line 227 of file Assembly.cs.

◆ HostContext

virtual long System.Reflection.Assembly.HostContext
get

Gets the host context with which the assembly was loaded.

Returns
An T:System.Int64 value that indicates the host context with which the assembly was loaded, if any.

Definition at line 238 of file Assembly.cs.

◆ ImageRuntimeVersion

virtual string System.Reflection.Assembly.ImageRuntimeVersion
get

Gets a string representing the version of the common language runtime (CLR) saved in the file containing the manifest.

Returns
The CLR version folder name. This is not a full path.

Definition at line 216 of file Assembly.cs.

◆ IsDynamic

virtual bool System.Reflection.Assembly.IsDynamic
get

Gets a value that indicates whether the current assembly was generated dynamically in the current process by using reflection emit.

Returns
true if the current assembly was generated dynamically in the current process; otherwise, false.

Definition at line 255 of file Assembly.cs.

◆ IsFullyTrusted

bool System.Reflection.Assembly.IsFullyTrusted
get

Gets a value that indicates whether the current assembly is loaded with full trust.

Returns
true if the current assembly is loaded with full trust; otherwise, false.

Definition at line 129 of file Assembly.cs.

◆ Location

virtual string System.Reflection.Assembly.Location
get

Gets the full path or UNC location of the loaded file that contains the manifest.

Returns
The location of the loaded file that contains the manifest. If the loaded file was shadow-copied, the location is that of the file after being shadow-copied. If the assembly is loaded from a byte array, such as when using the M:System.Reflection.Assembly.Load(System.Byte[]) method overload, the value returned is an empty string ("").
Exceptions
T:System.NotSupportedExceptionThe current assembly is a dynamic assembly, represented by an T:System.Reflection.Emit.AssemblyBuilder object.

Definition at line 205 of file Assembly.cs.

◆ ManifestModule

virtual Module System.Reflection.Assembly.ManifestModule
get

Gets the module that contains the manifest for the current assembly.

Returns
The module that contains the manifest for the assembly.

Definition at line 152 of file Assembly.cs.

◆ ModuleResolve

virtual ModuleResolveEventHandler System.Reflection.Assembly.ModuleResolve
addremove

Occurs when the common language runtime class loader cannot resolve a reference to an internal module of an assembly through normal means.

Definition at line 265 of file Assembly.cs.

◆ Modules

virtual IEnumerable<Module> System.Reflection.Assembly.Modules
get

Gets a collection that contains the modules in this assembly.

Returns
A collection that contains the modules in this assembly.

Definition at line 193 of file Assembly.cs.

◆ PermissionSet

virtual PermissionSet System.Reflection.Assembly.PermissionSet
get

Gets the grant set of the current assembly.

Returns
The grant set of the current assembly.

Definition at line 117 of file Assembly.cs.

◆ ReflectionOnly

virtual bool System.Reflection.Assembly.ReflectionOnly
get

Gets a T:System.Boolean value indicating whether this assembly was loaded into the reflection-only context.

Returns
true if the assembly was loaded into the reflection-only context, rather than the execution context; otherwise, false.

Definition at line 182 of file Assembly.cs.

◆ SecurityRuleSet

virtual SecurityRuleSet System.Reflection.Assembly.SecurityRuleSet
get

Gets a value that indicates which set of security rules the common language runtime (CLR) enforces for this assembly.

Returns
The security rule set that the CLR enforces for this assembly.

Definition at line 140 of file Assembly.cs.


The documentation for this class was generated from the following file: