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.

適用於