Assembly.GetModule(String) Assembly.GetModule(String) Assembly.GetModule(String) Assembly.GetModule(String) Method

定义

获取此程序集中的指定模块。Gets the specified module in this assembly.

public:
 virtual System::Reflection::Module ^ GetModule(System::String ^ name);
public System.Reflection.Module GetModule (string name);
abstract member GetModule : string -> System.Reflection.Module
override this.GetModule : string -> System.Reflection.Module
Public Function GetModule (name As String) As Module

参数

name
String String String String

请求的模块的名称。The name of the module being requested.

返回

所请求的模块,若未找到该模块则为 nullThe module being requested, or null if the module is not found.

实现

异常

name 参数为空字符串 ("")。The name parameter is an empty string ("").

无法加载已找到的文件。A file that was found could not be loaded.

name 不是有效的程序集。name is not a valid assembly.

注解

此方法适用于文件名。This method works on file names.

命名空间中Reflection.Emit的类发出动态模块的范围名称。Classes in the Reflection.Emit namespace emit the scope name for a dynamic module. 范围名称可以由Module.ScopeName属性确定。The scope name can be determined by the Module.ScopeName property. 传递所需Assembly.GetModule的模块类型。Pass the kind of module you want to Assembly.GetModule. 例如,如果你想要包含程序集清单的模块,请将模块的范围名称传递给GetModuleFor 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. 由一个Load具有 byte [] 参数的方法加载的程序集只有一个模块,这是清单模块。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.

可以使用Module.GetType从特定模块中检索类型。A type can be retrieved from a specific module using Module.GetType. Module.GetType包含清单的模块调用将不会启动整个程序集的搜索。Calling Module.GetType on the module containing the manifest will not initiate a search of the entire assembly. 若要从程序集中检索某一类型,而不考虑它所在的模块,则Assembly.GetType必须调用。To retrieve a type from an assembly, regardless of which module it is in, you must call Assembly.GetType.

适用于