Assembly.GetModule(String) 方法

定义

获取此程序集中的指定模块。

public:
 virtual System::Reflection::Module ^ GetModule(System::String ^ name);
public virtual System.Reflection.Module? GetModule (string name);
public virtual System.Reflection.Module GetModule (string name);
public 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
Public Function GetModule (name As String) As Module

参数

name
String

请求的模块的名称。

返回

所请求的模块,若未找到该模块则为 null

实现

例外

name 参数为 null

name 参数为空字符串 ("")。

无法加载已找到的文件。

未找到 name

name 不是有效的程序集。

注解

此方法适用于文件名。

命名空间中的 Reflection.Emit 类发出动态模块的范围名称。 范围名称可由 属性确定 Module.ScopeName 。 传递想要 Assembly.GetModule的模块类型。 例如,如果需要包含程序集清单的模块,请将模块的范围名称传递给 GetModule。 否则,请传递模块的文件名。 由具有 byte[] 参数的方法之 Load 一加载的程序集只有一个模块,即清单模块。 始终使用范围名称查找这些模块。

可以使用 从特定模块 Module.GetType检索类型。 在包含清单的模块上调用 Module.GetType 不会启动对整个程序集的搜索。 若要从程序集检索类型,无论它位于哪个模块中,都必须调用 Assembly.GetType

适用于