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 virtual System.Reflection.Module GetModule (string name);
abstract member GetModule : string -> System.Reflection.Module
override this.GetModule : string -> System.Reflection.Module
Public Overridable 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.GetModulePass 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.GetTypeA 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.GetTypeTo retrieve a type from an assembly, regardless of which module it is in, you must call Assembly.GetType.

适用于