This documentation is archived and is not being maintained.

Assembly.GetModule Method

Gets the specified module in this assembly.

[Visual Basic]
Public Function GetModule( _
   ByVal name As String _
) As Module
public Module GetModule(
 string name
public: Module* GetModule(
 String* name
public function GetModule(
   name : String
) : Module;


The name of the module being requested.

Return Value

The module being requested, or a null reference (Nothing in Visual Basic) if the module is not found.


Exception Type Condition
ArgumentNullException The name parameter is a null reference (Nothing in Visual Basic).
ArgumentException The name parameter is the empty string ("").
SecurityException The caller does not have the required permission.


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.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

Assembly Class | Assembly Members | System.Reflection Namespace