System.Reflection.Assembly Class

Assembly: Mscorlib.dll
Namespace: System.Reflection
Summary
Defines an Assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.
C# Syntax:
[Serializable]
public class Assembly : IEvidenceFactory, ICustomAttributeProvider, ISerializable
Thread Safety
This type is safe for multithreaded operations.
Remarks
Assemblies provide the infrastructure that allows the runtime to fully understand the contents of an application and to enforce the versioning and dependency rules defined by the application. These concepts are crucial for solving the versioning problem and for simplifying the deployment of runtime applications.
See also:
System.Reflection Namespace

System.Reflection.Assembly Member List:

Public Properties
CodeBase Read-only

Gets the location of the assembly as specified originally, for example, in an AssemblyName object.
EntryPoint Read-only

Gets the entry point of this assembly.
EscapedCodeBase Read-only

Gets the URI, including escape characters, that represents the codebase.
Evidence Read-only

Gets the evidence for this assembly.
FullName Read-only

Gets the display name of the assembly.
GlobalAssemblyCache Read-only

Gets a value indicating whether the assembly was loaded from the global assembly cache.
Location Read-only

Gets the location, in codebase format, of the loaded file that contains the manifest if not shadow-copied.
Public Methods
CreateInstance Overloaded:
CreateInstance(string typeName)

Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search.
CreateInstance Overloaded:
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.
CreateInstance Overloaded:
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.
CreateQualifiedName Creates the name of a type qualified by the display name of its assembly.
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetAssembly Gets the assembly in which the specified class is defined.
GetCallingAssembly Returns the Assembly of the method that invoked the currently executing method.
GetCustomAttributes Overloaded:
GetCustomAttributes(bool inherit)

Gets all the custom attributes for this assembly.
GetCustomAttributes Overloaded:
GetCustomAttributes(Type attributeType, bool inherit)

Gets the custom attributes for this assembly as specified by type.
GetEntryAssembly Gets the process executable in the default application domain. In other application domains, this is the first executable that was executed by AppDomain.ExecuteAssembly.
GetExecutingAssembly Gets the Assembly that the current code is running from.
GetExportedTypes Gets the exported types defined in this assembly.
GetFile Gets a FileStream for the specified file in the file table of the manifest of this assembly.
GetFiles Overloaded:
GetFiles()

Gets the files in the file table of an assembly manifest.
GetFiles Overloaded:
GetFiles(bool getResourceModules)

Gets the files in the file table of an assembly manifest, specifying whether to include resource modules.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetLoadedModules Overloaded:
GetLoadedModules()

Gets all the loaded modules that are part of this assembly.
GetLoadedModules Overloaded:
GetLoadedModules(bool getResourceModules)

Gets all the loaded modules that are part of this assembly, specifying whether to include resource modules.
GetManifestResourceInfo Returns information about how the given resource has been persisted.
GetManifestResourceNames Returns the names of all the resources in this assembly.
GetManifestResourceStream Overloaded:
GetManifestResourceStream(string name)

Loads the specified manifest resource from this assembly.
GetManifestResourceStream Overloaded:
GetManifestResourceStream(Type type, string name)

Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly.
GetModule Gets the specified module in this assembly.
GetModules Overloaded:
GetModules()

Gets all the modules that are part of this assembly.
GetModules Overloaded:
GetModules(bool getResourceModules)

Gets all the modules that are part of this assembly, specifying whether to include resource modules.
GetName Overloaded:
GetName()

Gets an AssemblyName for this assembly.
GetName Overloaded:
GetName(bool copiedName)

Gets an AssemblyName for this assembly, setting the codebase as specified by copiedName.
GetObjectData Gets serialization information with all of the data needed to reinstantiate this assembly.
GetReferencedAssemblies Gets the AssemblyName objects for all the assemblies referenced by this assembly.
GetSatelliteAssembly Overloaded:
GetSatelliteAssembly(CultureInfo culture)

Gets the satellite assembly for the specified culture.
GetSatelliteAssembly Overloaded:
GetSatelliteAssembly(CultureInfo culture, Version version)

Gets the specified version of the satellite assembly for the specified culture.
GetType
(inherited from System.Object)
Overloaded:
GetType()

See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
GetType Overloaded:
GetType(string name)

Gets the Type object with the specified name in the assembly instance.
GetType Overloaded:
GetType(string name, bool throwOnError)

Gets the Type object with the specified name in the assembly instance and optionally throws an exception.
GetType Overloaded:
GetType(string name, bool throwOnError, bool ignoreCase)

Gets the Type object with the specified name in the assembly instance, with the options of ignoring the case, and throwing an exception.
GetTypes Gets the types defined in this assembly.
IsDefined Indicates whether a custom attribute identified by the specified Type is defined.
Load Overloaded:
Load(AssemblyName assemblyRef)

Loads an assembly given its AssemblyName.
Load Overloaded:
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 domain of the caller.
Load Overloaded:
Load(string assemblyString)

Loads an assembly given its display name.
Load Overloaded:
Load(AssemblyName assemblyRef, Evidence assemblySecurity)

Loads the assembly with a Common Object File Format (COFF)-based image containing an emitted assembly. The assembly is loaded into the domain of the caller using the supplied evidence.
Load Overloaded:
Load(byte[] rawAssembly, byte[] rawSymbolStore)

Loads the assembly with a Common Object File Format (COFF)-based image containing an emitted assembly.
Load Overloaded:
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.
Load Overloaded:
Load(byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence)

Loads the assembly with a Common Object File Format (COFF)-based image containing an emitted assembly.
LoadFrom Overloaded:
LoadFrom(string assemblyFile)

Loads an assembly given its file name or path.
LoadFrom Overloaded:
LoadFrom(string assemblyFile, Evidence securityEvidence)

Loads an assembly given its file name or path and supplying security evidence.
LoadModule Overloaded:
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.
LoadModule Overloaded:
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.
LoadWithPartialName Overloaded:
LoadWithPartialName(string partialName)

Loads an assembly from the application directory or from the global assembly cache using a partial name.
LoadWithPartialName Overloaded:
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.
ToString Overridden:
Returns the full name of the assembly, also known as the display name.
Public Events
ModuleResolve Occurs when the common language runtime class loader cannot resolve a reference to an internal module of an assembly through normal means.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Reflection.Assembly Member Details

Property: CodeBase (read-only)
Summary
Gets the location of the assembly as specified originally, for example, in an AssemblyName object.
C# Syntax:
public virtual string CodeBase {get;}
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
Remarks
To get the absolute path to the loaded manifest-containing file, use the Assembly.Location property instead.

If the assembly was loaded as a byte array, this property returns the location of the caller of the Assembly.Load method, not the assembly.

Example
This example shows an expression that uses the CodeBase property.
            Assembly SampleAssembly;
            // Instantiate a target object.
            Int32 Integer1 = new Int32();
            Type Type1;
            // Set the Type instance to the target class type.
            Type1 = Integer1.GetType();
            // Instantiate an Assembly class to the assembly housing the Integer type.  
            SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
            // Gets the location of the assembly using file: protocol.
            Console.WriteLine("CodeBase=" + SampleAssembly.CodeBase);

    
.NET Framework Security:
FileIOPermission for access to the path. Associated enumeration: FileIOPermissionAccess.PathDiscovery.

Return to top


Property: EntryPoint (read-only)
Summary
Gets the entry point of this assembly.
C# Syntax:
public virtual MethodInfo EntryPoint {get;}

Return to top


Property: EscapedCodeBase (read-only)
Summary
Gets the URI, including escape characters, that represents the codebase.
C# Syntax:
public virtual string EscapedCodeBase {get;}
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
.NET Framework Security:
FileIOPermission for access to the path. Associated enumeration: FileIOPermissionAccess.PathDiscovery.

Return to top


Property: Evidence (read-only)
Summary
Gets the evidence for this assembly.
C# Syntax:
public virtual Evidence Evidence {get;}
Implements:
IEvidenceFactory.Evidence
Remarks
Evidence is the set of information that constitutes input to security policy decisions, such as what permissions can be granted to code.
See also:
Evidence

Return to top


Property: FullName (read-only)
Summary
Gets the display name of the assembly.
C# Syntax:
public virtual string FullName {get;}
Remarks
See AssemblyName for a description of the format of the display name of an assembly.
Example
            Assembly SampleAssembly;
            // Instantiate a target object.
            Int32 Integer1 = new Int32();
            Type Type1;
            // Set the Type instance to the target class type.
            Type1 = Integer1.GetType();
            // Instantiate an Assembly class to the assembly housing the Integer type.  
            SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
            // Write the display name of assembly including base name and version.
            Console.WriteLine("FullName=" + SampleAssembly.FullName);

    
See also:
MSDN: specifyingfullyqualifiedtypenames

Return to top


Property: GlobalAssemblyCache (read-only)
Summary
Gets a value indicating whether the assembly was loaded from the global assembly cache.
C# Syntax:
public bool GlobalAssemblyCache {get;}

Return to top


Property: Location (read-only)
Summary
Gets the location, in codebase format, of the loaded file that contains the manifest if not shadow-copied.
C# Syntax:
public virtual string Location {get;}
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
Example
            Assembly SampleAssembly;
            // Instantiate a target object.
            Int32 Integer1 = new Int32();
            Type Type1;
            // Set the Type instance to the target class type.
            Type1 = Integer1.GetType();
            // Instantiate an Assembly class to the assembly housing the Integer type.  
            SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
            // Display the physical location of the assembly containing the manifest.
            Console.WriteLine("Location=" + SampleAssembly.Location);

    
.NET Framework Security:
FileIOPermission for access to the path. Associated enumeration: FileIOPermissionAccess.PathDiscovery.

Return to top


Overloaded Method: CreateInstance(
   string typeName
)
Summary
Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search.
C# Syntax:
public object CreateInstance(
   string typeName
);
Parameters:

typeName

The name of the type to locate.

Return Value:
An instance of Object representing the type, with culture, arguments, and binding and activation attributes set to null, or null if typeName is not found.
Exceptions
Exception Type Condition
ArgumentException typeName is the empty string ("") or "\0anything".
ArgumentNullException typeName is null.

Return to top


Overloaded Method: CreateInstance(
   string typeName,
   bool ignoreCase
)
Summary
Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search.
C# Syntax:
public object CreateInstance(
   string typeName,
   bool ignoreCase
);
Parameters:

typeName

The name of the type to locate.

ignoreCase

true to ignore the case of the type name; otherwise, false.

Return Value:
An instance of Object representing the type, with culture, arguments, and activation attributes set to null, and BindingFlags set to NonPublic, or null if typeName is not found.
Exceptions
Exception Type Condition
ArgumentException typeName is the empty string ("") or "\0anything".
ArgumentNullException typeName is null.

Return to top


Overloaded Method: CreateInstance(
   string typeName,
   bool ignoreCase,
   BindingFlags bindingAttr,
   Binder binder,
   object[] args,
   CultureInfo culture,
   object[] activationAttributes
)
Summary
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.
C# Syntax:
public object CreateInstance(
   string typeName,
   bool ignoreCase,
   BindingFlags bindingAttr,
   Binder binder,
   object[] args,
   CultureInfo culture,
   object[] activationAttributes
);
Parameters:

typeName

The name of the type to locate.

ignoreCase

true to ignore the case of the type name; otherwise, false.

bindingAttr

A bitmask that affects the way in which the search is conducted. The value is a combination of bit flags from BindingFlags.

binder

An 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.

args

An array of type Object containing 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.

culture

An 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.)

activationAttributes

An array of type Object containing one or more activation attributes that can participate in the activation. An example of an activation attribute is:

URLAttribute(http://hostname/appname/objectURI)

An array of type Object containing one or more activation attributes that can participate in the activation. An example of an activation attribute is:

URLAttribute(http://hostname/appname/objectURI)

Return Value:
An instance of Object representing the type and matching the specified criteria, or null if typeName is not found.
Exceptions
Exception Type Condition
ArgumentException typeName is the empty string ("") or "\0anything".
ArgumentNullException typeName is null.
MissingFieldException The constructor cannot be found.

Return to top


Method: CreateQualifiedName(
   string assemblyName,
   string typeName
)
Summary
Creates the name of a type qualified by the display name of its assembly.
C# Syntax:
public static string CreateQualifiedName(
   string assemblyName,
   string typeName
);
Parameters:

assemblyName

The display name of an assembly.

typeName

The full name of a type.

Return Value:
A String that is the full name of the type qualified by the display name of the assembly.
Remarks
The format of the returned string is:

<FullTypeName>, <AssemblyDisplayName>

See AssemblyName for a description of the format of the display name of an assembly.

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~Assembly();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetAssembly(
   Type type
)
Summary
Gets the assembly in which the specified class is defined.
C# Syntax:
public static Assembly GetAssembly(
   Type type
);
Parameters:

type

A Type object representing a class in the assembly that will be returned.

Return Value:
The assembly in which the specified class is defined.
Exceptions
Exception Type Condition
ArgumentNullException type is null.
Example
            Assembly SampleAssembly;
            // Instantiate a target object.
            Int32 Integer1 = new Int32();
            Type Type1;
            // Set the Type instance to the target class type.
            Type1 = Integer1.GetType();
            // Instantiate an Assembly class to the assembly housing the Integer type.  
            SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
            // Gets the location of the assembly using file: protocol.
            Console.WriteLine("CodeBase=" + SampleAssembly.CodeBase);

    

Return to top


Method: GetCallingAssembly()
Summary
Returns the Assembly of the method that invoked the currently executing method.
C# Syntax:
public static Assembly GetCallingAssembly();
Return Value:
The Assembly object of the method that invoked the currently executing method.
Example
            Assembly SampleAssembly;
            // Instantiate a target object.
            Int32 Integer1 = new Int32();
            Type Type1;
            // Set the Type instance to the target class type.
            Type1 = Integer1.GetType();
            // Instantiate an Assembly class to the assembly housing the Integer type.  
            SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
            // Display the name of the assembly that is calling the method.
            Console.WriteLine("GetCallingAssembly=" + Assembly.GetCallingAssembly().FullName);

    

Return to top


Overloaded Method: GetCustomAttributes(
   bool inherit
)
Summary
Gets all the custom attributes for this assembly.
C# Syntax:
public virtual object[] GetCustomAttributes(
   bool inherit
);
Parameters:

inherit

This argument is ignored for objects of type Assembly.

Return Value:
An array of type Object containing the custom attributes for this assembly.
Implements:
ICustomAttributeProvider.GetCustomAttributes
Remarks
This method implements the corresponding ICustomAttributeProvider interface method. Therefore, the inherit parameter must be specified even though it is ignored.

A pseudo-attribute indicates bits of the core metadata that must be set when the attribute is present. Unlike a custom attribute that extends the metadata for a type and is saved along with the type, a pseudo-attribute modifies the metadata for the type and then is discarded. Some of the resulting bits cannot be accessed using existing reflection APIs.

The following table summarizes the different pseudo-attributes and the accessors for the bits that are available in reflection.



Pseudo-Attribute Metadata Bits Reflection Accessor
DllImportAttribute CorPInvokeMap DLL name No accessor for PInvokeMap for ordinary method/global method attributes. No accessor for DLL name.
GuidAttribute Stored as a real custom attribute. Accessed as a real custom attribute.
ComImportAttribute CorTypeAttr.tdImport Type.Attributes.Import
SerializableAttribute CorTypeAttr.tdSerializable Type.Attributes.Serializable
NonSerializedAttribute CorFieldAttr.fdNotSerialized FieldInfo.Attributes.NotSerialized
MethodImplAttribute CorMethodImpl MethodInfo.GetMethodImplementationFlags() ConstructorInfo.GetMethodImplementationFlags()
MarshalAsAttribute Various bits. No accessor.
PreserveSigAttribute CorMethodImpl.miOLE MethodInfo.GetMethodImplementationFlags().OLE ConstructorInfo.GetMethodImplementationFlags().OLE
InAttribute CorParamAttr.pdIn ParameterInfo.Attributes.In
OutAttribute CorParamAttr.pdOut ParameterInfo.Attributes.Out
StructLayoutAttribute CorTypeAttr.tdLayoutSequential CorTypeAttr.tdExplicitLayout CorTypeAttr.tdAnsiClass CorTypeAttr.tdUnicodeClass CorTypeAttr.tdAutoClass Class packing. Type.Attributes.LayoutSequential Type.Attributes.ExplicitLayout Type.Attributes.AnsiClass Type.Attributes.UnicodeClass Type.Attributes.AutoClass No accessor.
FieldOffsetAttribute Field offset. No accessor.
AssemblyLoadAttribute CorAssemblyFlags No accessor or enumerator.

Return to top


Overloaded Method: GetCustomAttributes(
   Type attributeType,
   bool inherit
)
Summary
Gets the custom attributes for this assembly as specified by type.
C# Syntax:
public virtual object[] GetCustomAttributes(
   Type attributeType,
   bool inherit
);
Parameters:

attributeType

The Type for which the custom attributes are to be returned.

inherit

This argument is ignored for objects of type Assembly.

Return Value:
An array of type Object containing the custom attributes for this assembly as specified by attributeType.
Exceptions
Exception Type Condition
ArgumentNullException attributeType is null.
ArgumentException attributeType is not a runtime type.
Implements:
ICustomAttributeProvider.GetCustomAttributes
Remarks
This method implements the corresponding ICustomAttributeProvider interface method. Therefore, the inherit parameter must be specified even though it is ignored.

Return to top


Method: GetEntryAssembly()
Summary
Gets the process executable in the default application domain. In other application domains, this is the first executable that was executed by AppDomain.ExecuteAssembly.
C# Syntax:
public static Assembly GetEntryAssembly();
Return Value:
The Assembly that is the process executable in the default application domain, or the first executable that was executed by AppDomain.ExecuteAssembly.

Return to top


Method: GetExecutingAssembly()
Summary
Gets the Assembly that the current code is running from.
C# Syntax:
public static Assembly GetExecutingAssembly();
Return Value:
The assembly that the current code is running from.
Example
            Assembly SampleAssembly;
            // Instantiate a target object.
            Int32 Integer1 = new Int32();
            Type Type1;
            // Set the Type instance to the target class type.
            Type1 = Integer1.GetType();
            // Instantiate an Assembly class to the assembly housing the Integer type.  
            SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
            // Display the name of the assembly currently executing
            Console.WriteLine("GetExecutingAssembly=" + Assembly.GetExecutingAssembly().FullName);

    

Return to top


Method: GetExportedTypes()
Summary
Gets the exported types defined in this assembly.
C# Syntax:
public virtual Type[] GetExportedTypes();
Return Value:
An array of type Type containing the exported types defined in this assembly.

Return to top


Method: GetFile(
   string name
)
Summary
Gets a FileStream for the specified file in the file table of the manifest of this assembly.
C# Syntax:
public virtual FileStream GetFile(
   string name
);
Parameters:

name

The name of the specified file.

Return Value:
A FileStream for the specified file, or null if the file is not found.
Exceptions
Exception Type Condition
FileLoadException A file that was found could not be loaded.
ArgumentNullException The name parameter is null.
SecurityException The caller does not have the required permission.
Remarks
This method works on both public and private resources.name should not include the path to the file.
.NET Framework Security:
FileIOPermission for access to the path and for reading the specified file. Associated enumerations: FileIOPermissionAccess.PathDiscovery and FileIOPermissionAccess.Read

Return to top


Overloaded Method: GetFiles()
Summary
Gets the files in the file table of an assembly manifest.
C# Syntax:
public virtual FileStream[] GetFiles();
Return Value:
An array of FileStream objects.
Remarks
This method only works on public resources.

Return to top


Overloaded Method: GetFiles(
   bool getResourceModules
)
Summary
Gets the files in the file table of an assembly manifest, specifying whether to include resource modules.
C# Syntax:
public virtual FileStream[] GetFiles(
   bool getResourceModules
);
Parameters:

getResourceModules

true to include resource modules; otherwise, false.

Return Value:
An array of FileStream objects.
Remarks
This method only works on public resources.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: GetLoadedModules()
Summary
Gets all the loaded modules that are part of this assembly.
C# Syntax:
public Module[] GetLoadedModules();
Return Value:
An array of modules.
Remarks
A type can be retrieved from a specific module using Module.GetType. Calling Module.GetType on the module containing the manifest will not initiate a search of the entire assembly. To retrieve a type from an assembly, regardless of which module it is in, you must call Assembly.GetType.

Return to top


Overloaded Method: GetLoadedModules(
   bool getResourceModules
)
Summary
Gets all the loaded modules that are part of this assembly, specifying whether to include resource modules.
C# Syntax:
public Module[] GetLoadedModules(
   bool getResourceModules
);
Parameters:

getResourceModules

true to include resource modules; otherwise, false.

Return Value:
An array of modules.

Return to top


Method: GetManifestResourceInfo(
   string resourceName
)
Summary
Returns information about how the given resource has been persisted.
C# Syntax:
public virtual ManifestResourceInfo GetManifestResourceInfo(
   string resourceName
);
Parameters:

resourceName

The name of the resource.

Return Value:
ManifestResourceInfo populated with information about the resource's topology, or null if the resource is not found.
Exceptions
Exception Type Condition
ArgumentNullException resourceName is null.
Remarks
This method works on both public and private resources.

Return to top


Method: GetManifestResourceNames()
Summary
Returns the names of all the resources in this assembly.
C# Syntax:
public virtual string[] GetManifestResourceNames();
Return Value:
An array of type String containing the names of all the resources.
Remarks
This method works on both public and private resources.

Return to top


Overloaded Method: GetManifestResourceStream(
   string name
)
Summary
Loads the specified manifest resource from this assembly.
C# Syntax:
public virtual Stream GetManifestResourceStream(
   string name
);
Parameters:

name

The name of the manifest resource being requested.

Return Value:
A Stream representing this manifest resource.
Remarks
This method works on both public and private resources.
See also:
MSDN: assemblymanifest

Return to top


Overloaded Method: GetManifestResourceStream(
   Type type,
   string name
)
Summary
Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly.
C# Syntax:
public virtual Stream GetManifestResourceStream(
   Type type,
   string name
);
Parameters:

type

The type whose namespace is used to scope the manifest resource name.

name

The name of the manifest resource being requested.

Return Value:
A Stream representing this manifest resource.
Remarks
This method works on both public and private resources.
Example
If the full name of type is "MyNameSpace.MyClasses" and name is "Net", GetManifestResourceStream will search for a resource named MyNameSpace.Net.
See also:
MSDN: assemblymanifest

Return to top


Method: GetModule(
   string name
)
Summary
Gets the specified module in this assembly.
C# Syntax:
public Module GetModule(
   string name
);
Parameters:

name

The name of the module being requested.

Return Value:
The Module being requested.
Remarks
This method works on file names.

Classes in the Reflection.Emit namespace emit the scope name for a dynamic module. The scope name can be determined by the Module.ScopeName property. Pass the kind of module you want to Assembly.GetModule. For example, if you want the module that contains the assembly manifest, pass the scope name of the module to GetModule. Otherwise, pass the file name of the module. Assemblies loaded by one of the Load methods that have a byte[] parameter have only one module, and that is the manifest module. Always seek these modules using the scope name.

A type can be retrieved from a specific module using Module.GetType. Calling Module.GetType on the module containing the manifest will not initiate a search of the entire assembly. To retrieve a type from an assembly, regardless of which module it is in, you must call Assembly.GetType.

Return to top


Overloaded Method: GetModules()
Summary
Gets all the modules that are part of this assembly.
C# Syntax:
public Module[] GetModules();
Return Value:
An array of modules.
Exceptions
Exception Type Condition
FileNotFoundException The module to be loaded does not specify a file name extension.
Remarks
A type can be retrieved from a specific module using Module.GetType. Calling Module.GetType on the module containing the manifest will not initiate a search of the entire assembly. To retrieve a type from an assembly, regardless of which module it is in, you must call Assembly.GetType.

Note Modules must be emitted with file name extensions.
Example
The first module in the returned array contains the assembly's manifest. So, the following code fragment gets the manifest module:
 Assembly mainAssembly = Assembly.GetExecutingAssembly();
 Module mainMod = mainAssembly.GetModules()[0];

    

Return to top


Overloaded Method: GetModules(
   bool getResourceModules
)
Summary
Gets all the modules that are part of this assembly, specifying whether to include resource modules.
C# Syntax:
public Module[] GetModules(
   bool getResourceModules
);
Parameters:

getResourceModules

true to include resource modules; otherwise, false.

Return Value:
An array of modules.
Remarks


Note Modules must be emitted with file name extensions.

Return to top


Overloaded Method: GetName()
Summary
Gets an AssemblyName for this assembly.
C# Syntax:
public virtual AssemblyName GetName();
Return Value:
An AssemblyName for this assembly.

Return to top


Overloaded Method: GetName(
   bool copiedName
)
Summary
Gets an AssemblyName for this assembly, setting the codebase as specified by copiedName.
C# Syntax:
public virtual AssemblyName GetName(
   bool copiedName
);
Parameters:

copiedName

true to set the Assembly.CodeBase to the location of the assembly after it was shadow copied; false to set Assembly.CodeBase to the original location.

Return Value:
An AssemblyName for this assembly.

Return to top


Method: GetObjectData(
   SerializationInfo info,
   StreamingContext context
)
Summary
Gets serialization information with all of the data needed to reinstantiate this assembly.
C# Syntax:
public virtual void GetObjectData(
   SerializationInfo info,
   StreamingContext context
);
Parameters:

info

The object to be populated with serialization information.

context

The destination context of the serialization.

Exceptions
Exception Type Condition
ArgumentNullException info is null.
Implements:
ISerializable.GetObjectData

Return to top


Method: GetReferencedAssemblies()
Summary
Gets the AssemblyName objects for all the assemblies referenced by this assembly.
C# Syntax:
public AssemblyName[] GetReferencedAssemblies();
Return Value:
An array of type AssemblyName containing all the assemblies referenced by this assembly.

Return to top


Overloaded Method: GetSatelliteAssembly(
   CultureInfo culture
)
Summary
Gets the satellite assembly for the specified culture.
C# Syntax:
public Assembly GetSatelliteAssembly(
   CultureInfo culture
);
Parameters:

culture

The specified culture.

Return Value:
The specified satellite assembly.
Exceptions
Exception Type Condition
ArgumentNullException culture is null.
FileNotFoundException The assembly cannot be found.
FileLoadException The satellite assembly with a matching file name was found, but the CultureInfo did not match the one specified.
Remarks
Satellite assemblies contain localized resources, as distinct from main application assemblies, which contain non-localizable executable code and resources for a single culture that serve as the default or neutral culture.

Call this method to use your current assembly version.

Return to top


Overloaded Method: GetSatelliteAssembly(
   CultureInfo culture,
   Version version
)
Summary
Gets the specified version of the satellite assembly for the specified culture.
C# Syntax:
public Assembly GetSatelliteAssembly(
   CultureInfo culture,
   Version version
);
Parameters:

culture

The specified culture.

version

The version of the satellite assembly.

Return Value:
The specified satellite assembly.
Exceptions
Exception Type Condition
ArgumentNullException culture is null.
FileLoadException The satellite assembly with a matching file name was found, but the CultureInfo or the version did not match the one specified.
FileNotFoundException The assembly cannot be found.
Remarks
Satellite assemblies contain localized resources, as distinct from main application assemblies, which contain non-localizable executable code and resources for a single culture that serve as the default or neutral culture.

Call GetSatelliteAssembly to use your current assembly version.

If version is null, the current assembly version is used if both the resource and main assemblies are signed.

Return to top


Overloaded Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: GetType(
   string name
)
Summary
Gets the Type object with the specified name in the assembly instance.
C# Syntax:
public virtual Type GetType(
   string name
);
Parameters:

name

The full name of the type.

Return Value:
A Type object that represents the specified class.
Exceptions
Exception Type Condition
ReflectionTypeLoadException The type is not in the assembly instance you are calling the method on.
ArgumentException name is invalid.
ArgumentNullException name is null.
SecurityException The caller does not have the required permission.
Remarks
Unlike Type.GetType, which requires a string that includes both the type name and the assembly name, this method requires only the type name because only the assembly on which you are calling GetType is used.
.NET Framework Security:
ReflectionPermission for reflecting methods that are not public. Associated enumerations: ReflectionPermissionFlag.MemberAccess, ReflectionPermissionFlag.TypeInformation

Return to top


Overloaded Method: GetType(
   string name,
   bool throwOnError
)
Summary
Gets the Type object with the specified name in the assembly instance and optionally throws an exception.
C# Syntax:
public virtual Type GetType(
   string name,
   bool throwOnError
);
Parameters:

name

The full name of the type.

throwOnError

true to throw an exception if the type is not found; otherwise, null.

Return Value:
A Type object that represents the specified class.
Exceptions
Exception Type Condition
ArgumentNullException name is null.
Remarks
Unlike Type.GetType, which requires a string that includes both the type name and the assembly name, this method requires only the type name because only the assembly on which you are calling GetType is used.
.NET Framework Security:
ReflectionPermission for reflecting methods that are not public. Associated enumerations: ReflectionPermissionFlag.MemberAccess, ReflectionPermissionFlag.TypeInformation

Return to top


Overloaded Method: GetType(
   string name,
   bool throwOnError,
   bool ignoreCase
)
Summary
Gets the Type object with the specified name in the assembly instance, with the options of ignoring the case, and throwing an exception.
C# Syntax:
public Type GetType(
   string name,
   bool throwOnError,
   bool ignoreCase
);
Parameters:

name

The full name of the type.

throwOnError

true to throw an exception if the type is not found; otherwise, null.

ignoreCase

true to ignore the case of the type name; otherwise, false.

Return Value:
A Type object that represents the specified class.
Exceptions
Exception Type Condition
ArgumentNullException name is null.
Remarks
Unlike Type.GetType, which requires a string that includes both the type name and the assembly name, this method requires only the type name because only the assembly on which you are calling GetType is used.
.NET Framework Security:
ReflectionPermission for reflecting methods that are not public. Associated enumerations: ReflectionPermissionFlag.MemberAccess, ReflectionPermissionFlag.TypeInformation

Return to top


Method: GetTypes()
Summary
Gets the types defined in this assembly.
C# Syntax:
public virtual Type[] GetTypes();
Return Value:
An array of type Type containing objects for all the types defined in this assembly.
Example
            Assembly SampleAssembly;
            SampleAssembly = Assembly.LoadFrom("c:\\Sample.Assembly.dll");
            // Obtain a reference to a method known to exist in assembly.
            MethodInfo Method = SampleAssembly.GetTypes()[0].GetMethod("Method1");
            // Obtain a reference to the parameters collection of the MethodInfo instance.
            ParameterInfo[] Params = Method.GetParameters();
            // Display information about method parameters.
            // Param = sParam1
            //   Type = System.String
            //   Position = 0
            //   Optional=False
            foreach (ParameterInfo Param in Params){
                Console.WriteLine("Param=" + Param.Name.ToString());
                Console.WriteLine("  Type=" + Param.ParameterType.ToString());
                Console.WriteLine("  Position=" + Param.Position.ToString());
                Console.WriteLine("  Optional=" + Param.IsOptional.ToString());
            }

    
.NET Framework Security:
ReflectionPermission for reflecting methods that are not public. Associated enumerations: ReflectionPermissionFlag.MemberAccess, ReflectionPermissionFlag.TypeInformation

Return to top


Method: IsDefined(
   Type attributeType,
   bool inherit
)
Summary
Indicates whether a custom attribute identified by the specified Type is defined.
C# Syntax:
public virtual bool IsDefined(
   Type attributeType,
   bool inherit
);
Parameters:

attributeType

The Type for which the custom attributes are to be checked.

inherit

This argument is ignored for objects of this type.

Return Value:
true if a custom attribute identified by the specified Type is defined; otherwise, false.
Exceptions
Exception Type Condition
ArgumentNullException attributeType is null.
Implements:
ICustomAttributeProvider.IsDefined

Return to top


Overloaded Method: Load(
   AssemblyName assemblyRef
)
Summary
Loads an assembly given its AssemblyName.
C# Syntax:
public static Assembly Load(
   AssemblyName assemblyRef
);
Parameters:

assemblyRef

The AssemblyName object that describes the assembly to be loaded.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException assemblyRef is null.
FileNotFoundException assemblyRef is not found.
BadImageFormatException assemblyFile is not a valid assembly.
Remarks
The assembly is loaded into the domain of the caller.

The Load methods use the default load context, which records the assembly name and assembly instance information for the set of assemblies that is the transitive closure of the assemblies referenced by a managed application. The default load context applies to assemblies that are loaded with a Load method and that use a fully qualified assembly reference.

See also:
AssemblyName

Return to top


Overloaded Method: Load(
   byte[] rawAssembly
)
Summary
Loads the assembly with a Common Object File Format (COFF)-based image containing an emitted assembly. The assembly is loaded into the domain of the caller.
C# Syntax:
public static Assembly Load(
   byte[] rawAssembly
);
Parameters:

rawAssembly

An array of type byte that is a COFF-based image containing an emitted assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException rawAssembly is null.
BadImageFormatException rawAssembly is not a valid assembly.
Remarks
The assembly is loaded into the domain of the caller.

The Load methods use the default load context, which records the assembly name and assembly instance information for the set of assemblies that is the transitive closure of the assemblies referenced by a managed application. The default load context applies to assemblies that are loaded with a Load method and that use a fully qualified assembly reference.

See also:
AssemblyName

Return to top


Overloaded Method: Load(
   string assemblyString
)
Summary
Loads an assembly given its display name.
C# Syntax:
public static Assembly Load(
   string assemblyString
);
Parameters:

assemblyString

The display name of the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException assemblyString is null.
FileNotFoundException assemblyString is not found.
BadImageFormatException assemblyFile is not a valid assembly.
Remarks
The Load methods use the default load context, which records the assembly name and assembly instance information for the set of assemblies that is the transitive closure of the assemblies referenced by a managed application. The default load context applies to assemblies that are loaded with a Load method and that use a fully qualified assembly reference.

Reflecting on Managed Extensions for C++ executable files might throw a BadImageFormatException. This is most likely caused by C++ compiler stripping the relocation addresses or the .Reloc section from your executable file. To preserve the .reloc address for your C++ executable file, specify /fixed:no when you are linking.

Example
            Assembly SampleAssembly;
            // Load the assembly by providing the type name.
            SampleAssembly = Assembly.Load("System.Data");
            foreach (String Resource in SampleAssembly.GetManifestResourceNames()){
                Console.WriteLine(Resource);
            }

    
See also:
AssemblyName | Assembly.LoadFrom

Return to top


Overloaded Method: Load(
   AssemblyName assemblyRef,
   Evidence assemblySecurity
)
Summary
Loads the assembly with a Common Object File Format (COFF)-based image containing an emitted assembly. The assembly is loaded into the domain of the caller using the supplied evidence.
C# Syntax:
public static Assembly Load(
   AssemblyName assemblyRef,
   Evidence assemblySecurity
);
Parameters:

assemblyRef

The AssemblyName object that describes the assembly to be loaded.

assemblySecurity

Evidence for loading the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException assemblyRef is null.
FileNotFoundException assemblyRef is not found.
BadImageFormatException assemblyFile is not a valid assembly.
FileLoadException An assembly or module was loaded twice with two different evidences.
Remarks
Evidence is the set of information that constitutes input to security policy decisions, such as what permissions can be granted to code.

The assembly is loaded into the domain of the caller.

The Load methods use the default load context, which records the assembly name and assembly instance information for the set of assemblies that is the transitive closure of the assemblies referenced by a managed application. The default load context applies to assemblies that are loaded with a Load method and that use a fully qualified assembly reference.

See also:
Evidence

Return to top


Overloaded Method: Load(
   byte[] rawAssembly,
   byte[] rawSymbolStore
)
Summary
Loads the assembly with a Common Object File Format (COFF)-based image containing an emitted assembly.
C# Syntax:
public static Assembly Load(
   byte[] rawAssembly,
   byte[] rawSymbolStore
);
Parameters:

rawAssembly

An array of type byte that is a COFF-based image containing an emitted assembly.

rawSymbolStore

An array of type byte containing the raw bytes representing the symbols for the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException rawAssembly is null.
BadImageFormatException assemblyFile is not a valid assembly.
Remarks
The assembly is loaded into the domain of the caller, and the raw bytes representing the symbols for the assembly are also loaded.

The Load methods use the default load context, which records the assembly name and assembly instance information for the set of assemblies that is the transitive closure of the assemblies referenced by a managed application. The default load context applies to assemblies that are loaded with a Load method and that use a fully qualified assembly reference.

Return to top


Overloaded Method: Load(
   string assemblyString,
   Evidence assemblySecurity
)
Summary
Loads an assembly given its display name, loading the assembly into the domain of the caller using the supplied evidence.
C# Syntax:
public static Assembly Load(
   string assemblyString,
   Evidence assemblySecurity
);
Parameters:

assemblyString

The display name of the assembly.

assemblySecurity

Evidence for loading the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException assemblyString is null.
FileNotFoundException assemblyString is not found.
BadImageFormatException assemblyFile is not a valid assembly.
FileLoadException An assembly or module was loaded twice with two different evidences.
Remarks
Evidence is the set of information that constitutes input to security policy decisions, such as what permissions can be granted to code.

The assembly is loaded into the domain of the caller.

The Load methods use the default load context, which records the assembly name and assembly instance information for the set of assemblies that is the transitive closure of the assemblies referenced by a managed application. The default load context applies to assemblies that are loaded with a Load method and that use a fully qualified assembly reference.

Reflecting on Managed Extensions for C++ executable files might throw a BadImageFormatException. This is most likely caused by C++ compiler stripping the relocation addresses or the .Reloc section from your executable file. To preserve the .reloc address for your C++ executable file, specify /fixed:no when you are linking.

See also:
Evidence

Return to top


Overloaded Method: Load(
   byte[] rawAssembly,
   byte[] rawSymbolStore,
   Evidence securityEvidence
)
Summary
Loads the assembly with a Common Object File Format (COFF)-based image containing an emitted assembly.
C# Syntax:
public static Assembly Load(
   byte[] rawAssembly,
   byte[] rawSymbolStore,
   Evidence securityEvidence
);
Parameters:

rawAssembly

An array of type byte that is a COFF-based image containing an emitted assembly.

rawSymbolStore

An array of type byte containing the raw bytes representing the symbols for the assembly.

securityEvidence

Evidence for loading the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException rawAssembly is null.
BadImageFormatException assemblyFile is not a valid assembly.
FileLoadException An assembly or module was loaded twice with two different evidences.
SecurityException The caller does not have the required permission.
Remarks
The assembly is loaded into the domain of the caller using the supplied evidence. The raw bytes representing the symbols for the assembly are also loaded.

The Load methods use the default load context, which records the assembly name and assembly instance information for the set of assemblies that is the transitive closure of the assemblies referenced by a managed application. The default load context applies to assemblies that are loaded with a Load method and that use a fully qualified assembly reference.

.NET Framework Security:
SecurityPermission to provide evidence. Associated enumeration: SecurityPermissionFlag.ControlEvidence.

Return to top


Overloaded Method: LoadFrom(
   string assemblyFile
)
Summary
Loads an assembly given its file name or path.
C# Syntax:
public static Assembly LoadFrom(
   string assemblyFile
);
Parameters:

assemblyFile

The name or path of the file that contains the manifest of the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException assemblyFile is null.
FileNotFoundException assemblyFile is not found, or the module you are trying to load does not specify a filename extension.
BadImageFormatException assemblyFile is not a valid assembly.
SecurityException A codebase that does not start with "file://" was specified without the required WebPermission.
FileLoadException An assembly or module was loaded twice with two different evidences, or the assembly name is longer than MAX_PATH characters.
Remarks
The assemblyFile parameter must refer to a URI without escape characters. This method supplies escape characters for all invalid characters in the URI.

assemblyFile is relative to the current directory, and the assembly is loaded into the domain of the caller.

The LoadFrom methods use a load context that records the assembly name and the assembly instance information for the set of assemblies that is the transitive closure of the assemblies loaded by the application using LoadFrom. The LoadFrom load context applies to assemblies that are loaded using their locations.

Example
            Assembly SampleAssembly;
            SampleAssembly = Assembly.LoadFrom("c:\\Sample.Assembly.dll");
            // Obtain a reference to a method known to exist in assembly.
            MethodInfo Method = SampleAssembly.GetTypes()[0].GetMethod("Method1");
            // Obtain a reference to the parameters collection of the MethodInfo instance.
            ParameterInfo[] Params = Method.GetParameters();
            // Display information about method parameters.
            // Param = sParam1
            //   Type = System.String
            //   Position = 0
            //   Optional=False
            foreach (ParameterInfo Param in Params){
                Console.WriteLine("Param=" + Param.Name.ToString());
                Console.WriteLine("  Type=" + Param.ParameterType.ToString());
                Console.WriteLine("  Position=" + Param.Position.ToString());
                Console.WriteLine("  Optional=" + Param.IsOptional.ToString());
            }

    
.NET Framework Security:
EnvironmentPermission for determining the current directory. Associated enumeration: EnvironmentPermissionAccess.AllAccess
.NET Framework Security:
FileIOPermission for reading a URI that begins with "file://". Associated enumeration: FileIOPermissionAccess.Read
.NET Framework Security:
System.Net.WebPermission (not supported on the shared source CLI) for reading a URI that does not begin with "file://".

Return to top


Overloaded Method: LoadFrom(
   string assemblyFile,
   Evidence securityEvidence
)
Summary
Loads an assembly given its file name or path and supplying security evidence.
C# Syntax:
public static Assembly LoadFrom(
   string assemblyFile,
   Evidence securityEvidence
);
Parameters:

assemblyFile

The name or path of the file that contains the manifest of the assembly.

securityEvidence

Evidence for loading the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException assemblyFile is null.
FileNotFoundException assemblyFile is not found, or the module you are trying to load does not specify a filename extension.
BadImageFormatException assemblyFile is not a valid assembly.
SecurityException A codebase that does not start with "file://" was specified without the required WebPermission.
FileLoadException An assembly or module was loaded twice with two different evidences, or the assembly name is longer than MAX_PATH characters.
Remarks
Evidence is the set of information that constitutes input to security policy decisions, such as what permissions can be granted to code.

The assemblyFile parameter must refer to a URI without escape characters. This method supplies escape characters for all invalid characters in the URI.

assemblyFile is relative to the current directory, and the assembly is loaded into the domain of the caller.

The LoadFrom methods use a load context that records the assembly name and the assembly instance information for the set of assemblies that is the transitive closure of the assemblies loaded by the application using LoadFrom. The LoadFrom load context applies to assemblies that are loaded using their locations.

.NET Framework Security:
EnvironmentPermission for determining the current directory. Associated enumeration: EnvironmentPermissionAccess.AllAccess
.NET Framework Security:
FileIOPermission for reading a URI that begins with "file://". Associated enumeration: FileIOPermissionAccess.Read
.NET Framework Security:
System.Net.WebPermission (not supported on the shared source CLI) for reading a URI that does not begin with "file://".
See also:
Evidence

Return to top


Overloaded Method: LoadModule(
   string moduleName,
   byte[] rawModule
)
Summary
Loads the module, internal to this assembly, with a Common Object File Format (COFF)-based image containing an emitted module, or a resource file.
C# Syntax:
public Module LoadModule(
   string moduleName,
   byte[] rawModule
);
Parameters:

moduleName

Name of the module. Must correspond to a File name in this assembly's manifest.

rawModule

An array of type byte that is a COFF-based image containing an emitted module, or a resource.

Return Value:
The loaded Module.
Exceptions
Exception Type Condition
ArgumentNullException moduleName or rawModule is null.
ArgumentException moduleName does not match a File entry in this assembly's manifest.
BadImageFormatException rawModule is not a valid module.
SecurityException The caller does not have the required permission.
.NET Framework Security:
SecurityPermission to provide evidence. Associated enumeration: SecurityPermissionFlag.ControlEvidence.

Return to top


Overloaded Method: LoadModule(
   string moduleName,
   byte[] rawModule,
   byte[] rawSymbolStore
)
Summary
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.
C# Syntax:
public Module LoadModule(
   string moduleName,
   byte[] rawModule,
   byte[] rawSymbolStore
);
Parameters:

moduleName

Name of the module. Must correspond to a File name in this assembly's manifest.

rawModule

An array of type byte that is a COFF-based image containing an emitted module, or a resource.

rawSymbolStore

An array of type byte containing the raw bytes representing the symbols for the module. Must be null if this is a resource file.

Return Value:
The loaded Module.
Exceptions
Exception Type Condition
ArgumentNullException moduleName or rawModule is null.
ArgumentException moduleName does not match a File entry in this assembly's manifest.
BadImageFormatException rawModule is not a valid module.
SecurityException The caller does not have the required permission.
.NET Framework Security:
SecurityPermission to provide evidence. Associated enumeration: SecurityPermissionFlag.ControlEvidence.

Return to top


Overloaded Method: LoadWithPartialName(
   string partialName
)
Summary
Loads an assembly from the application directory or from the global assembly cache using a partial name.
C# Syntax:
public static Assembly LoadWithPartialName(
   string partialName
);
Parameters:

partialName

The partial name of the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException partialName is null.
FileNotFoundException partialName is not found.
Remarks
Applications that load assemblies with this method will be impacted by upgrades of those assemblies. Therefore, do not use this method unless necessary, and even then, consider redesigning the application to use Assembly.Load or Assembly.LoadFrom.
See also:
Assembly.Load | Assembly.LoadFrom

Return to top


Overloaded Method: LoadWithPartialName(
   string partialName,
   Evidence securityEvidence
)
Summary
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.
C# Syntax:
public static Assembly LoadWithPartialName(
   string partialName,
   Evidence securityEvidence
);
Parameters:

partialName

The partial name of the assembly.

securityEvidence

Evidence for loading the assembly.

Return Value:
The loaded assembly.
Exceptions
Exception Type Condition
ArgumentNullException partialName is null.
FileNotFoundException partialName is not found.
FileLoadException An assembly or module was loaded twice with two different evidences.
SecurityException The caller does not have the required permission.
Remarks
Evidence is the set of information that constitutes input to security policy decisions, such as what permissions can be granted to code.

Applications that load assemblies with this method will be impacted by upgrades of those assemblies. Therefore, do not use this method unless necessary, and even then, consider redesigning the application to use Assembly.Load or Assembly.LoadFrom.

See also:
Assembly.Load | Assembly.LoadFrom

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: ToString()
Summary
Returns the full name of the assembly, also known as the display name.
C# Syntax:
public override string ToString();
Return Value:
The full name of the assembly, or the class name if the full name of the assembly cannot be determined.

Return to top


Event: ModuleResolve
Summary
Occurs when the common language runtime class loader cannot resolve a reference to an internal module of an assembly through normal means.
C# Syntax:
public event ModuleResolveEventHandler ModuleResolve;
Remarks
This event gives the callback a chance to find and load the module itself and return it.
.NET Framework Security:
SecurityPermission to create and manipulate an application domain. Associated enumeration: SecurityPermissionFlag.ControlAppDomain.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.