ModuleBuilder 類別

定義

定義及表示動態組件中的模組。

public ref class ModuleBuilder : System::Reflection::Module
public ref class ModuleBuilder abstract : System::Reflection::Module
public ref class ModuleBuilder : System::Reflection::Module, System::Runtime::InteropServices::_ModuleBuilder
public class ModuleBuilder : System.Reflection.Module
public abstract class ModuleBuilder : System.Reflection.Module
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
public class ModuleBuilder : System.Reflection.Module, System.Runtime.InteropServices._ModuleBuilder
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public class ModuleBuilder : System.Reflection.Module, System.Runtime.InteropServices._ModuleBuilder
type ModuleBuilder = class
    inherit Module
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
type ModuleBuilder = class
    inherit Module
    interface _ModuleBuilder
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ModuleBuilder = class
    inherit Module
    interface _ModuleBuilder
Public Class ModuleBuilder
Inherits Module
Public MustInherit Class ModuleBuilder
Inherits Module
Public Class ModuleBuilder
Inherits Module
Implements _ModuleBuilder
繼承
ModuleBuilder
屬性
實作

範例

下列程式代碼範例示範如何使用 ModuleBuilder 來建立動態模組。 請注意,ModuleBuilder 是在 中AssemblyBuilder呼叫 DefineDynamicModule ,而不是透過建構函式來建立。

using namespace System;
using namespace System::Reflection;
using namespace System::Reflection::Emit;
public ref class CodeGenerator
{
private:
   AssemblyBuilder^ myAssemblyBuilder;

public:
   CodeGenerator()
   {
      // Get the current application domain for the current thread.
      AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
      AssemblyName^ myAssemblyName = gcnew AssemblyName;
      myAssemblyName->Name = "TempAssembly";

      // Define a dynamic assembly in the current application domain.
      myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );

      // Define a dynamic module in this assembly.
      ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" );

      // Define a runtime class with specified name and attributes.
      TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public );

      // Add 'Greeting' field to the class, with the specified attribute and type.
      FieldBuilder^ greetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public );
      array<Type^>^myMethodArgs = {String::typeid};

      // Add 'MyMethod' method to the class, with the specified attribute and signature.
      MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, CallingConventions::Standard, nullptr, myMethodArgs );
      ILGenerator^ methodIL = myMethod->GetILGenerator();
      methodIL->EmitWriteLine( "In the method..." );
      methodIL->Emit( OpCodes::Ldarg_0 );
      methodIL->Emit( OpCodes::Ldarg_1 );
      methodIL->Emit( OpCodes::Stfld, greetingField );
      methodIL->Emit( OpCodes::Ret );
      myTypeBuilder->CreateType();
   }

   property AssemblyBuilder^ MyAssembly 
   {
      AssemblyBuilder^ get()
      {
         return this->myAssemblyBuilder;
      }
   }
};

int main()
{
   CodeGenerator^ myCodeGenerator = gcnew CodeGenerator;

   // Get the assembly builder for 'myCodeGenerator' object.
   AssemblyBuilder^ myAssemblyBuilder = myCodeGenerator->MyAssembly;

   // Get the module builder for the above assembly builder object .
   ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->GetDynamicModule( "TempModule" );
   Console::WriteLine( "The fully qualified name and path to this module is :{0}", myModuleBuilder->FullyQualifiedName );
   Type^ myType = myModuleBuilder->GetType( "TempClass" );
   MethodInfo^ myMethodInfo = myType->GetMethod( "MyMethod" );

   // Get the token used to identify the method within this module.
   MethodToken myMethodToken = myModuleBuilder->GetMethodToken( myMethodInfo );
   Console::WriteLine( "Token used to identify the method of 'myType'"
   " within the module is {0:x}", myMethodToken.Token );
   array<Object^>^args = {"Hello."};
   Object^ myObject = Activator::CreateInstance( myType, nullptr, nullptr );
   myMethodInfo->Invoke( myObject, args );
}
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Security.Permissions;

public class CodeGenerator
{
   AssemblyBuilder myAssemblyBuilder;
   public CodeGenerator()
   {
      // Get the current application domain for the current thread.
      AppDomain myCurrentDomain = AppDomain.CurrentDomain;
      AssemblyName myAssemblyName = new AssemblyName();
      myAssemblyName.Name = "TempAssembly";

      // Define a dynamic assembly in the current application domain.
      myAssemblyBuilder = myCurrentDomain.DefineDynamicAssembly
                     (myAssemblyName, AssemblyBuilderAccess.Run);

      // Define a dynamic module in this assembly.
      ModuleBuilder myModuleBuilder = myAssemblyBuilder.
                                      DefineDynamicModule("TempModule");

      // Define a runtime class with specified name and attributes.
      TypeBuilder myTypeBuilder = myModuleBuilder.DefineType
                                       ("TempClass",TypeAttributes.Public);

      // Add 'Greeting' field to the class, with the specified attribute and type.
      FieldBuilder greetingField = myTypeBuilder.DefineField("Greeting",
                                                            typeof(String), FieldAttributes.Public);
      Type[] myMethodArgs = { typeof(String) };

      // Add 'MyMethod' method to the class, with the specified attribute and signature.
      MethodBuilder myMethod = myTypeBuilder.DefineMethod("MyMethod",
         MethodAttributes.Public, CallingConventions.Standard, null,myMethodArgs);

      ILGenerator methodIL = myMethod.GetILGenerator();
      methodIL.EmitWriteLine("In the method...");
      methodIL.Emit(OpCodes.Ldarg_0);
      methodIL.Emit(OpCodes.Ldarg_1);
      methodIL.Emit(OpCodes.Stfld, greetingField);
      methodIL.Emit(OpCodes.Ret);
      myTypeBuilder.CreateType();
   }
   public AssemblyBuilder MyAssembly
   {
      get
      {
         return this.myAssemblyBuilder;
      }
   }
}
public class TestClass
{
   public static void Main()
   {
      CodeGenerator myCodeGenerator = new CodeGenerator();
      // Get the assembly builder for 'myCodeGenerator' object.
      AssemblyBuilder myAssemblyBuilder = myCodeGenerator.MyAssembly;
      // Get the module builder for the above assembly builder object .
      ModuleBuilder myModuleBuilder = myAssemblyBuilder.
                                                           GetDynamicModule("TempModule");
      Console.WriteLine("The fully qualified name and path to this "
                               + "module is :" +myModuleBuilder.FullyQualifiedName);
      Type myType = myModuleBuilder.GetType("TempClass");
      MethodInfo myMethodInfo =
                                                myType.GetMethod("MyMethod");
       // Get the token used to identify the method within this module.
      MethodToken myMethodToken =
                        myModuleBuilder.GetMethodToken(myMethodInfo);
      Console.WriteLine("Token used to identify the method of 'myType'"
                    + " within the module is {0:x}",myMethodToken.Token);
     object[] args={"Hello."};
     object myObject = Activator.CreateInstance(myType,null,null);
     myMethodInfo.Invoke(myObject,args);
   }
}
Imports System.Reflection
Imports System.Reflection.Emit
Imports System.Security.Permissions

Public Class CodeGenerator
   Private myAssemblyBuilder As AssemblyBuilder

   Public Sub New()
      ' Get the current application domain for the current thread.
      Dim myCurrentDomain As AppDomain = AppDomain.CurrentDomain
      Dim myAssemblyName As New AssemblyName()
      myAssemblyName.Name = "TempAssembly"

      ' Define a dynamic assembly in the current application domain.
      myAssemblyBuilder = _
               myCurrentDomain.DefineDynamicAssembly(myAssemblyName, AssemblyBuilderAccess.Run)

      ' Define a dynamic module in this assembly.
      Dim myModuleBuilder As ModuleBuilder = myAssemblyBuilder.DefineDynamicModule("TempModule")

      ' Define a runtime class with specified name and attributes.
      Dim myTypeBuilder As TypeBuilder = _
               myModuleBuilder.DefineType("TempClass", TypeAttributes.Public)

      ' Add 'Greeting' field to the class, with the specified attribute and type.
      Dim greetingField As FieldBuilder = _
               myTypeBuilder.DefineField("Greeting", GetType(String), FieldAttributes.Public)
      Dim myMethodArgs As Type() = {GetType(String)}

      ' Add 'MyMethod' method to the class, with the specified attribute and signature.
      Dim myMethod As MethodBuilder = _
               myTypeBuilder.DefineMethod("MyMethod", MethodAttributes.Public, _
               CallingConventions.Standard, Nothing, myMethodArgs)

      Dim methodIL As ILGenerator = myMethod.GetILGenerator()
      methodIL.EmitWriteLine("In the method...")
      methodIL.Emit(OpCodes.Ldarg_0)
      methodIL.Emit(OpCodes.Ldarg_1)
      methodIL.Emit(OpCodes.Stfld, greetingField)
      methodIL.Emit(OpCodes.Ret)
      myTypeBuilder.CreateType()
   End Sub

   Public ReadOnly Property MyAssembly() As AssemblyBuilder
      Get
         Return Me.myAssemblyBuilder
      End Get
   End Property
End Class

Public Class TestClass
   <PermissionSetAttribute(SecurityAction.Demand, Name:="FullTrust")> _
   Public Shared Sub Main()
      Dim myCodeGenerator As New CodeGenerator()
      ' Get the assembly builder for 'myCodeGenerator' object.
      Dim myAssemblyBuilder As AssemblyBuilder = myCodeGenerator.MyAssembly
      ' Get the module builder for the above assembly builder object .
      Dim myModuleBuilder As ModuleBuilder = myAssemblyBuilder.GetDynamicModule("TempModule")
      Console.WriteLine("The fully qualified name and path to this " + _
                        "module is :" + myModuleBuilder.FullyQualifiedName)
      Dim myType As Type = myModuleBuilder.GetType("TempClass")
      Dim myMethodInfo As MethodInfo = myType.GetMethod("MyMethod")
      ' Get the token used to identify the method within this module.
      Dim myMethodToken As MethodToken = myModuleBuilder.GetMethodToken(myMethodInfo)
      Console.WriteLine("Token used to identify the method of 'myType'" + _
                        " within the module is {0:x}", myMethodToken.Token)
      Dim args As Object() = {"Hello."}
      Dim myObject As Object = Activator.CreateInstance(myType, Nothing, Nothing)
      myMethodInfo.Invoke(myObject, args)
   End Sub
End Class

備註

若要取得的 ModuleBuilder實例,請使用 AssemblyBuilder.DefineDynamicModule 方法。

建構函式

ModuleBuilder()

初始化 ModuleBuilder 類別的新執行個體。

屬性

Assembly

取得定義此 ModuleBuilder 執行個體的動態組件。

Assembly

取得這個 Assembly 執行個體的合適 Module

(繼承來源 Module)
CustomAttributes

取得包含此模組之自訂屬性的集合。

(繼承來源 Module)
FullyQualifiedName

取得 String,表示這個模組的完整名稱和路徑。

MDStreamVersion

取得中繼資料流的版本。

MDStreamVersion

取得中繼資料流的版本。

(繼承來源 Module)
MetadataToken

取得語彙基元,可識別中繼資料中的目前動態模組。

MetadataToken

取得語彙基元,可識別中繼資料中的模組。

(繼承來源 Module)
ModuleHandle

取得模組的控制代碼。

(繼承來源 Module)
ModuleVersionId

取得可用來區別兩個模組版本的全域唯一識別碼 (UUID)。

ModuleVersionId

取得可用來區別兩個模組版本的全域唯一識別碼 (UUID)。

(繼承來源 Module)
Name

表示這是記憶體中模組的字串。

Name

取得 String,表示路徑已移除的模組名稱。

(繼承來源 Module)
ScopeName

取得表示動態模組名稱的字串。

ScopeName

取得表示模組名稱的字串。

(繼承來源 Module)

方法

CreateGlobalFunctions()

完成這個動態模組的全域函式定義和全域資料定義。

CreateGlobalFunctionsCore()

在衍生類別中覆寫時,完成此動態模組的全域函式定義和全域數據定義。

DefineDocument(String, Guid, Guid, Guid)

定義來源的文件。

DefineEnum(String, TypeAttributes, Type)

定義列舉型別,此列舉型別為實值型別 (Value Type),具有指定之型別的單一非靜態欄位 (稱為 value__)。

DefineEnumCore(String, TypeAttributes, Type)

在衍生類別中覆寫時,定義列舉型別,此型別是實值型別,其具有稱為指定型別之單一非靜態字段value__。

DefineGlobalMethod(String, MethodAttributes, CallingConventions, Type, Type[])

使用指定的名稱、屬性、呼叫慣例、傳回型別和參數型別,來定義全域方法。

DefineGlobalMethod(String, MethodAttributes, CallingConventions, Type, Type[], Type[], Type[], Type[][], Type[][])

使用指定的名稱、屬性、呼叫慣例、傳回型別、傳回型別的自訂修飾詞、參數型別以及參數型別的自訂修飾詞,來定義全域方法。

DefineGlobalMethod(String, MethodAttributes, Type, Type[])

使用指定的名稱、屬性、傳回型別和參數型別,來定義全域方法。

DefineGlobalMethodCore(String, MethodAttributes, CallingConventions, Type, Type[], Type[], Type[], Type[][], Type[][])

在衍生類別中覆寫時,使用指定的名稱、屬性、呼叫慣例、傳回型別、傳回型別的自定義修飾詞,以及參數類型的自定義修飾詞來定義全域方法。

DefineInitializedData(String, Byte[], FieldAttributes)

在可攜式執行檔 (PE) 的 .sdata 區段中定義初始化的資料欄位。

DefineInitializedDataCore(String, Byte[], FieldAttributes)

在衍生類別中覆寫時,請在可攜式可執行檔的 .sdata 區段中定義初始化的數據字段, (PE) 檔案。

DefineManifestResource(String, Stream, ResourceAttributes)

定義二進位大型物件 (BLOB),表示要嵌入動態組件的資訊清單資源。

DefinePInvokeMethod(String, String, MethodAttributes, CallingConventions, Type, Type[], CallingConvention, CharSet)

使用指定的名稱、定義方法的 DLL 名稱、方法的屬性、方法的呼叫慣例、方法的傳回型別、方法的參數型別和 PInvoke 旗標,來定義 PInvoke 方法。

DefinePInvokeMethod(String, String, String, MethodAttributes, CallingConventions, Type, Type[], CallingConvention, CharSet)

使用指定的名稱、定義方法的 DLL 名稱、方法的屬性、方法的呼叫慣例、方法的傳回型別、方法的參數型別和 PInvoke 旗標,來定義 PInvoke 方法。

DefinePInvokeMethodCore(String, String, String, MethodAttributes, CallingConventions, Type, Type[], CallingConvention, CharSet)

在衍生類別中覆寫時,定義 PInvoke 方法。

DefineResource(String, String)

定義要儲存於這個模組中的具名 Managed 內嵌資源。

DefineResource(String, String, ResourceAttributes)

以指定的屬性定義要儲存於這個模組中的具名 Managed 內嵌資源。

DefineType(String)

在這個模組中使用指定的名稱來建構私用型別的 TypeBuilder

DefineType(String, TypeAttributes)

建構 TypeBuilder 需指定型別名稱和型別屬性。

DefineType(String, TypeAttributes, Type)

建構 TypeBuilder 需指定型別名稱、其屬性和定義型別所擴充的型別。

DefineType(String, TypeAttributes, Type, Int32)

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別和型別的總共大小。

DefineType(String, TypeAttributes, Type, PackingSize)

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別和型別的封裝大小。

DefineType(String, TypeAttributes, Type, PackingSize, Int32)

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別、定義型別的封裝大小和定義型別的總共大小。

DefineType(String, TypeAttributes, Type, Type[])

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別和定義型別實作的介面。

DefineTypeCore(String, TypeAttributes, Type, Type[], PackingSize, Int32)

在衍生類別中覆寫時,建 TypeBuilder構 。

DefineUninitializedData(String, Int32, FieldAttributes)

在可攜式執行檔 (PE) 的 .sdata 區段中定義未初始化的資料欄位。

DefineUninitializedDataCore(String, Int32, FieldAttributes)

在衍生類別中覆寫時,請在可攜式可執行檔的 .sdata 區段中定義未初始化的數據欄位, (PE) 檔案。

DefineUnmanagedResource(Byte[])

指定二進位大型物件 (BLOB) 位元組,來定義 Unmanaged 內嵌資源。

DefineUnmanagedResource(String)

定義 Unmanaged 資源,需指定 Win32 資源檔名稱。

Equals(Object)

傳回值,指出此執行個體是否等於指定的物件。

Equals(Object)

判斷這個模組和指定的物件是否相等。

(繼承來源 Module)
FindTypes(TypeFilter, Object)

傳回指定篩選器和篩選準則所接受的類別陣列。

(繼承來源 Module)
GetArrayMethod(Type, String, CallingConventions, Type, Type[])

傳回陣列類別上的具名方法。

GetArrayMethodCore(Type, String, CallingConventions, Type, Type[])

在衍生類別中覆寫時,傳回數位類別上的具名方法。

GetArrayMethodToken(Type, String, CallingConventions, Type, Type[])

傳回陣列類別上具名方法的語彙基元。

GetConstructorToken(ConstructorInfo)

傳回語彙基元,用來在這個模組中識別指定的建構函式。

GetConstructorToken(ConstructorInfo, IEnumerable<Type>)

傳回語彙基元,用來識別在這個模組中具有指定屬性和參數型別的建構函式。

GetCustomAttributes(Boolean)

傳回已套用至目前 ModuleBuilder 的所有自訂屬性。

GetCustomAttributes(Boolean)

傳回所有自訂屬性。

(繼承來源 Module)
GetCustomAttributes(Type, Boolean)

傳回已套用至目前 ModuleBuilder 的所有自訂屬性,以及衍生自指定屬性類型的所有自訂屬性。

GetCustomAttributes(Type, Boolean)

取得指定型別的自訂屬性。

(繼承來源 Module)
GetCustomAttributesData()

傳回已套用至目前 ModuleBuilder 之屬性的相關資訊,表示為 CustomAttributeData 物件。

GetCustomAttributesData()

傳回目前模組的 CustomAttributeData 物件清單,這些物件可用於僅限反映的內容中。

(繼承來源 Module)
GetField(String)

傳回具有指定名稱的欄位。

(繼承來源 Module)
GetField(String, BindingFlags)

傳回可攜式執行檔 (PE) 的 .sdata 區域中所定義、有指定之名稱和繫結屬性的模組層級欄位。

GetField(String, BindingFlags)

傳回具有指定名稱和繫結屬性的欄位。

(繼承來源 Module)
GetFieldMetadataToken(FieldInfo)

在衍生類別中覆寫時,傳回指定 FieldInfo 相對於Module的元數據令牌。

GetFields()

傳回模組中定義的全域欄位。

(繼承來源 Module)
GetFields(BindingFlags)

傳回可攜式執行檔 (PE) 的 .sdata 區域中所定義、符合指定之繫結旗標的所有欄位。

GetFields(BindingFlags)

傳回定義於模組上且符合指定繫結旗標的全域欄位。

(繼承來源 Module)
GetFieldToken(FieldInfo)

傳回語彙基元,用來在這個模組中識別指定欄位。

GetHashCode()

傳回這個執行個體的雜湊碼。

GetHashCode()

傳回這個執行個體的雜湊碼。

(繼承來源 Module)
GetMethod(String)

傳回具有指定名稱的方法。

(繼承來源 Module)
GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

傳回方法,該方法具有指定的名稱、繫結資訊、呼叫慣例和參數類型及修飾詞。

(繼承來源 Module)
GetMethod(String, Type[])

傳回具有指定名稱及參數類型的方法。

(繼承來源 Module)
GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

傳回符合指定之準則的模組層級方法。

GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

傳回方法實作,根據指定準則。

(繼承來源 Module)
GetMethodMetadataToken(ConstructorInfo)

在衍生類別中覆寫時,傳回指定 ConstructorInfo 相對於Module的元數據令牌。

GetMethodMetadataToken(MethodInfo)

在衍生類別中覆寫時,傳回指定 MethodInfo 相對於Module的元數據令牌。

GetMethods()

傳回模組中定義的全域方法。

(繼承來源 Module)
GetMethods(BindingFlags)

傳回為目前 ModuleBuilder 在模組層級上已定義而且符合指定之繫結旗標的所有方法。

GetMethods(BindingFlags)

傳回定義於模組上且符合指定繫結旗標的全域方法。

(繼承來源 Module)
GetMethodToken(MethodInfo)

傳回語彙基元,用來在這個模組中識別指定方法。

GetMethodToken(MethodInfo, IEnumerable<Type>)

傳回語彙基元,用來識別在這個模組中具有指定屬性和參數型別的方法。

GetObjectData(SerializationInfo, StreamingContext)
已淘汰.

提供序列化物件的 ISerializable 實作。

(繼承來源 Module)
GetPEKind(PortableExecutableKinds, ImageFileMachine)

取得值組,表示模組中的程式碼性質,以及模組的目標平台。

GetPEKind(PortableExecutableKinds, ImageFileMachine)

取得值組,表示模組中的程式碼性質,以及模組的目標平台。

(繼承來源 Module)
GetSignatureMetadataToken(SignatureHelper)

在衍生類別中覆寫時,傳回指定 SignatureHelper 相對於Module的元數據令牌。

GetSignatureToken(Byte[], Int32)

針對有指定之字元陣列和簽章長度的簽章,定義語彙基元。

GetSignatureToken(SignatureHelper)

針對由指定的 SignatureHelper 所定義的簽章,定義語彙基元。

GetSignerCertificate()

傳回 X509Certificate 物件,對應到這個模組所屬之組件的 Authenticode 簽章中所包含的憑證。 如果組件還未經 Authenticode 簽名,則傳回 null

GetSignerCertificate()

傳回 X509Certificate 物件,對應到這個模組所屬之組件的 Authenticode 簽章中所包含的憑證。 如果組件還未經 Authenticode 簽名,則傳回 null

(繼承來源 Module)
GetStringConstant(String)

傳回模組常數集區中指定字串的權杖。

GetStringMetadataToken(String)

在衍生類別中覆寫時,傳回相對於Module之指定 String 常數的元數據標記。

GetSymWriter()

傳回符號寫入器,與這個動態模組相關聯。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
GetType(String)

取得在模組中定義的具名型別。

GetType(String)

執行區分大小寫的搜尋,傳回指定的類型。

(繼承來源 Module)
GetType(String, Boolean)

取得模組中定義的具名型別,選擇性地忽略型別名稱的大小寫。

GetType(String, Boolean)

傳回指定的類型,使用指定的大小寫搜尋模組。

(繼承來源 Module)
GetType(String, Boolean, Boolean)

取得模組中定義的具名型別,選擇性地忽略型別名稱的大小寫。 如果找不到型別,則是選擇性的擲回例外狀況。

GetType(String, Boolean, Boolean)

傳回指定的型別,並指定是否要對模組進行區分大小寫的搜尋,以及是否要在找不到型別時擲回例外狀況。

(繼承來源 Module)
GetTypeMetadataToken(Type)

在衍生類別中覆寫時,傳回指定 Type 相對於Module的元數據令牌。

GetTypes()

傳回在這個模組中定義的所有類別。

GetTypes()

傳回此模組中定義的所有類型。

(繼承來源 Module)
GetTypeToken(String)

傳回語彙基元,用來識別具有指定之名稱的型別。

GetTypeToken(Type)

傳回語彙基元,用來在這個模組中識別指定的型別。

IsDefined(Type, Boolean)

傳回值,這個值表示指定的屬性型別是否已套用至此模組。

IsDefined(Type, Boolean)

傳回值,這個值表示指定的屬性型別是否已套用至此模組。

(繼承來源 Module)
IsResource()

取得值,指出物件是否為資源。

IsResource()

取得值,指出物件是否為資源。

(繼承來源 Module)
IsTransient()

傳回值,這個值表示這個動態模組是否為暫時性。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ResolveField(Int32)

傳回指定之中繼資料語彙基元所識別的欄位。

(繼承來源 Module)
ResolveField(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的欄位。

ResolveField(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的欄位。

(繼承來源 Module)
ResolveMember(Int32)

傳回指定之中繼資料語彙基元所識別的型別或成員。

(繼承來源 Module)
ResolveMember(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的型別或成員。

ResolveMember(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的型別或成員。

(繼承來源 Module)
ResolveMethod(Int32)

傳回指定之中繼資料語彙基元所識別的方法或建構函式。

(繼承來源 Module)
ResolveMethod(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的方法或建構函式。

ResolveMethod(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的方法或建構函式。

(繼承來源 Module)
ResolveSignature(Int32)

傳回中繼資料語彙基元所識別的簽章 Blob (二進位大型物件)。

ResolveSignature(Int32)

傳回中繼資料語彙基元所識別的簽章 Blob (二進位大型物件)。

(繼承來源 Module)
ResolveString(Int32)

傳回指定之中繼資料語彙基元所識別的字串。

ResolveString(Int32)

傳回指定之中繼資料語彙基元所識別的字串。

(繼承來源 Module)
ResolveType(Int32)

傳回指定之中繼資料語彙基元所識別的型別。

(繼承來源 Module)
ResolveType(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的型別。

ResolveType(Int32, Type[], Type[])

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的型別。

(繼承來源 Module)
SetCustomAttribute(ConstructorInfo, Byte[])

將自訂屬性套用至這個模組,方式是使用指定的二進位大型物件 (BLOB) 表示該屬性。

SetCustomAttribute(CustomAttributeBuilder)

使用自訂屬性產生器,將自訂屬性套用至這個模組。

SetCustomAttributeCore(ConstructorInfo, ReadOnlySpan<Byte>)

在衍生類別中覆寫時,在此元件上設定自定義屬性。

SetSymCustomAttribute(String, Byte[])

這個方法不會有任何作用。

SetUserEntryPoint(MethodInfo)

設定使用者進入點。

ToString()

傳回模組名稱。

(繼承來源 Module)

明確介面實作

_Module.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Module)
_Module.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。

(繼承來源 Module)
_Module.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Module)
_Module.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。

(繼承來源 Module)
_ModuleBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

如需這個成員的說明,請參閱 GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

_ModuleBuilder.GetTypeInfo(UInt32, UInt32, IntPtr)

如需這個成員的說明,請參閱 GetTypeInfo(UInt32, UInt32, IntPtr)

_ModuleBuilder.GetTypeInfoCount(UInt32)

如需這個成員的說明,請參閱 GetTypeInfoCount(UInt32)

_ModuleBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

如需這個成員的說明,請參閱 Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

ICustomAttributeProvider.GetCustomAttributes(Boolean)

傳回這個成員中定義的所有自訂屬性的陣列 (但具名屬性除外),如果沒有自訂屬性,則傳回空陣列。

(繼承來源 Module)
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

傳回這個成員中定義的自訂屬性陣列 (依類型識別),如果沒有該類型的自訂屬性,則傳回空陣列。

(繼承來源 Module)
ICustomAttributeProvider.IsDefined(Type, Boolean)

指出此成員上是否有定義一個或多個 attributeType 執行個體。

(繼承來源 Module)

擴充方法

GetCustomAttribute(Module, Type)

擷取指定型別的自訂屬性,此屬性套用至指定模組。

GetCustomAttribute<T>(Module)

擷取指定型別的自訂屬性,此屬性套用至指定模組。

GetCustomAttributes(Module)

擷取套用至指定模組的自訂屬性集合。

GetCustomAttributes(Module, Type)

擷取指定型別的自訂屬性集合,此集合套用至指定模組。

GetCustomAttributes<T>(Module)

擷取指定型別的自訂屬性集合,此集合套用至指定模組。

IsDefined(Module, Type)

指出是否將所指定型別的自訂屬性套用至指定的模組。

GetModuleVersionId(Module)

定義及表示動態組件中的模組。

HasModuleVersionId(Module)

定義及表示動態組件中的模組。

適用於