ModuleBuilder 類別

定義

定義及表示動態組件中的模組。Defines and represents a module in a dynamic assembly.

public ref 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
    interface _ModuleBuilder
Public Class ModuleBuilder
Inherits Module
Implements _ModuleBuilder
繼承
ModuleBuilder
屬性
實作

範例

下列程式碼範例將示範如何使用 ModuleBuilder 來建立動態模組。The following code sample demonstrates the use of ModuleBuilder to create a dynamic module. 請注意,ModuleBuilder 是藉由呼叫 AssemblyBuilder中的 DefineDynamicModule 來建立,而不是透過函式。Note that the ModuleBuilder is created by calling DefineDynamicModule in AssemblyBuilder, rather than through a constructor.

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
{
   [PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
   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 方法。To get an instance of ModuleBuilder, use the AssemblyBuilder.DefineDynamicModule method.

建構函式

ModuleBuilder()

屬性

Assembly

取得定義此 ModuleBuilder 執行個體的動態組件。Gets the dynamic assembly that defined this instance of ModuleBuilder.

CustomAttributes

取得包含此模組之自訂屬性的集合。Gets a collection that contains this module's custom attributes.

(繼承來源 Module)
FullyQualifiedName

取得 String,表示這個模組的完整名稱和路徑。Gets a String representing the fully qualified name and path to this module.

MDStreamVersion

取得中繼資料流的版本。Gets the metadata stream version.

MetadataToken

取得語彙基元,可識別中繼資料中的目前動態模組。Gets a token that identifies the current dynamic module in metadata.

ModuleHandle

取得模組的控制代碼。Gets a handle for the module.

(繼承來源 Module)
ModuleVersionId

取得可用來區別兩個模組版本的全域唯一識別碼 (UUID)。Gets a universally unique identifier (UUID) that can be used to distinguish between two versions of a module.

Name

表示這是記憶體中模組的字串。A string that indicates that this is an in-memory module.

ScopeName

取得表示動態模組名稱的字串。Gets a string that represents the name of the dynamic module.

方法

CreateGlobalFunctions()

完成這個動態模組的全域函式定義和全域資料定義。Completes the global function definitions and global data definitions for this dynamic module.

DefineDocument(String, Guid, Guid, Guid)

定義來源的文件。Defines a document for source.

DefineEnum(String, TypeAttributes, Type)

定義列舉型別,此列舉型別為實值型別 (Value Type),具有指定之型別的單一非靜態欄位 (稱為 value__)。Defines an enumeration type that is a value type with a single non-static field called value__ of the specified type.

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

使用指定的名稱、屬性、呼叫慣例、傳回型別和參數型別,來定義全域方法。Defines a global method with the specified name, attributes, calling convention, return type, and parameter types.

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

使用指定的名稱、屬性、呼叫慣例、傳回型別、傳回型別的自訂修飾詞、參數型別以及參數型別的自訂修飾詞,來定義全域方法。Defines a global method with the specified name, attributes, calling convention, return type, custom modifiers for the return type, parameter types, and custom modifiers for the parameter types.

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

使用指定的名稱、屬性、傳回型別和參數型別,來定義全域方法。Defines a global method with the specified name, attributes, return type, and parameter types.

DefineInitializedData(String, Byte[], FieldAttributes)

在可攜式執行檔 (PE) 的 .sdata 區段中定義初始化的資料欄位。Defines an initialized data field in the .sdata section of the portable executable (PE) file.

DefineManifestResource(String, Stream, ResourceAttributes)

定義二進位大型物件 (BLOB),表示要嵌入動態組件的資訊清單資源。Defines a binary large object (BLOB) that represents a manifest resource to be embedded in the dynamic assembly.

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

使用指定的名稱、定義方法的 DLL 名稱、方法的屬性、方法的呼叫慣例、方法的傳回型別、方法的參數型別和 PInvoke 旗標,來定義 PInvoke 方法。Defines a PInvoke method with the specified name, the name of the DLL in which the method is defined, the attributes of the method, the calling convention of the method, the return type of the method, the types of the parameters of the method, and the PInvoke flags.

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

使用指定的名稱、定義方法的 DLL 名稱、方法的屬性、方法的呼叫慣例、方法的傳回型別、方法的參數型別和 PInvoke 旗標,來定義 PInvoke 方法。Defines a PInvoke method with the specified name, the name of the DLL in which the method is defined, the attributes of the method, the calling convention of the method, the return type of the method, the types of the parameters of the method, and the PInvoke flags.

DefineResource(String, String)

定義要儲存於這個模組中的具名 Managed 內嵌資源。Defines the named managed embedded resource to be stored in this module.

DefineResource(String, String, ResourceAttributes)

以指定的屬性定義要儲存於這個模組中的具名 Managed 內嵌資源。Defines the named managed embedded resource with the given attributes that is to be stored in this module.

DefineType(String)

在這個模組中使用指定的名稱來建構私用型別的 TypeBuilderConstructs a TypeBuilder for a private type with the specified name in this module.

DefineType(String, TypeAttributes)

建構 TypeBuilder 需指定型別名稱和型別屬性。Constructs a TypeBuilder given the type name and the type attributes.

DefineType(String, TypeAttributes, Type)

建構 TypeBuilder 需指定型別名稱、其屬性和定義型別所擴充的型別。Constructs a TypeBuilder given type name, its attributes, and the type that the defined type extends.

DefineType(String, TypeAttributes, Type, Int32)

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別和型別的總共大小。Constructs a TypeBuilder given the type name, the attributes, the type that the defined type extends, and the total size of the type.

DefineType(String, TypeAttributes, Type, PackingSize)

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別和型別的封裝大小。Constructs a TypeBuilder given the type name, the attributes, the type that the defined type extends, and the packing size of the type.

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

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別、定義型別的封裝大小和定義型別的總共大小。Constructs a TypeBuilder given the type name, attributes, the type that the defined type extends, the packing size of the defined type, and the total size of the defined type.

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

建構 TypeBuilder 需指定型別名稱、屬性、定義型別所擴充的型別和定義型別實作的介面。Constructs a TypeBuilder given the type name, attributes, the type that the defined type extends, and the interfaces that the defined type implements.

DefineUninitializedData(String, Int32, FieldAttributes)

在可攜式執行檔 (PE) 的 .sdata 區段中定義未初始化的資料欄位。Defines an uninitialized data field in the .sdata section of the portable executable (PE) file.

DefineUnmanagedResource(Byte[])

指定二進位大型物件 (BLOB) 位元組,來定義 Unmanaged 內嵌資源。Defines an unmanaged embedded resource given an opaque binary large object (BLOB) of bytes.

DefineUnmanagedResource(String)

定義 Unmanaged 資源,需指定 Win32 資源檔名稱。Defines an unmanaged resource given the name of Win32 resource file.

Equals(Object)

傳回值,指出此執行個體是否等於指定的物件。Returns a value that indicates whether this instance is equal to the specified object.

FindTypes(TypeFilter, Object)

傳回指定篩選器和篩選準則所接受的類別陣列。Returns an array of classes accepted by the given filter and filter criteria.

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

傳回陣列類別上的具名方法。Returns the named method on an array class.

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

傳回陣列類別上具名方法的語彙基元。Returns the token for the named method on an array class.

GetConstructorToken(ConstructorInfo)

傳回語彙基元,用來在這個模組中識別指定的建構函式。Returns the token used to identify the specified constructor within this module.

GetConstructorToken(ConstructorInfo, IEnumerable<Type>)

傳回語彙基元,用來識別在這個模組中具有指定屬性和參數型別的建構函式。Returns the token used to identify the constructor that has the specified attributes and parameter types within this module.

GetCustomAttributes(Boolean)

傳回已套用至目前 ModuleBuilder 的所有自訂屬性。Returns all the custom attributes that have been applied to the current ModuleBuilder.

GetCustomAttributes(Type, Boolean)

傳回已套用至目前 ModuleBuilder 的所有自訂屬性,以及衍生自指定屬性類型的所有自訂屬性。Returns all the custom attributes that have been applied to the current ModuleBuilder, and that derive from a specified attribute type.

GetCustomAttributesData()

傳回已套用至目前 ModuleBuilder 之屬性的相關資訊,表示為 CustomAttributeData 物件。Returns information about the attributes that have been applied to the current ModuleBuilder, expressed as CustomAttributeData objects.

GetField(String)

傳回具有指定名稱的欄位。Returns a field having the specified name.

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

傳回可攜式執行檔 (PE) 的 .sdata 區域中所定義、有指定之名稱和繫結屬性的模組層級欄位。Returns a module-level field, defined in the .sdata region of the portable executable (PE) file, that has the specified name and binding attributes.

GetFields()

傳回模組中定義的全域欄位。Returns the global fields defined on the module.

(繼承來源 Module)
GetFields(BindingFlags)

傳回可攜式執行檔 (PE) 的 .sdata 區域中所定義、符合指定之繫結旗標的所有欄位。Returns all fields defined in the .sdata region of the portable executable (PE) file that match the specified binding flags.

GetFieldToken(FieldInfo)

傳回語彙基元,用來在這個模組中識別指定欄位。Returns the token used to identify the specified field within this module.

GetHashCode()

傳回這個執行個體的雜湊碼。Returns the hash code for this instance.

GetMethod(String)

傳回具有指定名稱的方法。Returns a method having the specified name.

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

傳回方法,該方法具有指定的名稱、繫結資訊、呼叫慣例和參數類型及修飾詞。Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers.

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

傳回具有指定名稱及參數類型的方法。Returns a method having the specified name and parameter types.

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

傳回符合指定之準則的模組層級方法。Returns the module-level method that matches the specified criteria.

GetMethods()

傳回模組中定義的全域方法。Returns the global methods defined on the module.

(繼承來源 Module)
GetMethods(BindingFlags)

傳回為目前 ModuleBuilder 在模組層級上已定義而且符合指定之繫結旗標的所有方法。Returns all the methods that have been defined at the module level for the current ModuleBuilder, and that match the specified binding flags.

GetMethodToken(MethodInfo)

傳回語彙基元,用來在這個模組中識別指定方法。Returns the token used to identify the specified method within this module.

GetMethodToken(MethodInfo, IEnumerable<Type>)

傳回語彙基元,用來識別在這個模組中具有指定屬性和參數型別的方法。Returns the token used to identify the method that has the specified attributes and parameter types within this module.

GetObjectData(SerializationInfo, StreamingContext)

提供序列化物件的 ISerializable 實作。Provides an ISerializable implementation for serialized objects.

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

取得值組,表示模組中的程式碼性質,以及模組的目標平台。Gets a pair of values indicating the nature of the code in a module and the platform targeted by the module.

GetSignatureToken(Byte[], Int32)

針對有指定之字元陣列和簽章長度的簽章,定義語彙基元。Defines a token for the signature that has the specified character array and signature length.

GetSignatureToken(SignatureHelper)

針對由指定的 SignatureHelper 所定義的簽章,定義語彙基元。Defines a token for the signature that is defined by the specified SignatureHelper.

GetSignerCertificate()

傳回 X509Certificate 物件,對應到這個模組所屬之組件的 Authenticode 簽章中所包含的憑證。Returns an X509Certificate object corresponding to the certificate included in the Authenticode signature of the assembly which this module belongs to. 如果組件還未經 Authenticode 簽名,則傳回 nullIf the assembly has not been Authenticode signed, null is returned.

GetStringConstant(String)

傳回模組常數集區中指定字串的權杖。Returns the token of the given string in the module's constant pool.

GetSymWriter()

傳回符號寫入器,與這個動態模組相關聯。Returns the symbol writer associated with this dynamic module.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
GetType(String)

取得在模組中定義的具名型別。Gets the named type defined in the module.

GetType(String, Boolean)

取得模組中定義的具名型別,選擇性地忽略型別名稱的大小寫。Gets the named type defined in the module, optionally ignoring the case of the type name.

GetType(String, Boolean, Boolean)

取得模組中定義的具名型別,選擇性地忽略型別名稱的大小寫。Gets the named type defined in the module, optionally ignoring the case of the type name. 如果找不到型別,則是選擇性的擲回例外狀況。Optionally throws an exception if the type is not found.

GetTypes()

傳回在這個模組中定義的所有類別。Returns all the classes defined within this module.

GetTypeToken(String)

傳回語彙基元,用來識別具有指定之名稱的型別。Returns the token used to identify the type with the specified name.

GetTypeToken(Type)

傳回語彙基元,用來在這個模組中識別指定的型別。Returns the token used to identify the specified type within this module.

IsDefined(Type, Boolean)

傳回值,這個值表示指定的屬性型別是否已套用至此模組。Returns a value that indicates whether the specified attribute type has been applied to this module.

IsResource()

取得值,指出物件是否為資源。Gets a value indicating whether the object is a resource.

IsTransient()

傳回值,這個值表示這個動態模組是否為暫時性。Returns a value that indicates whether this dynamic module is transient.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ResolveField(Int32)

傳回指定之中繼資料語彙基元所識別的欄位。Returns the field identified by the specified metadata token.

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

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的欄位。Returns the field identified by the specified metadata token, in the context defined by the specified generic type parameters.

ResolveMember(Int32)

傳回指定之中繼資料語彙基元所識別的型別或成員。Returns the type or member identified by the specified metadata token.

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

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的型別或成員。Returns the type or member identified by the specified metadata token, in the context defined by the specified generic type parameters.

ResolveMethod(Int32)

傳回指定之中繼資料語彙基元所識別的方法或建構函式。Returns the method or constructor identified by the specified metadata token.

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

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的方法或建構函式。Returns the method or constructor identified by the specified metadata token, in the context defined by the specified generic type parameters.

ResolveSignature(Int32)

傳回中繼資料語彙基元所識別的簽章 Blob (二進位大型物件)。Returns the signature blob identified by a metadata token.

ResolveString(Int32)

傳回指定之中繼資料語彙基元所識別的字串。Returns the string identified by the specified metadata token.

ResolveType(Int32)

傳回指定之中繼資料語彙基元所識別的型別。Returns the type identified by the specified metadata token.

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

以指定之泛型型別參數所定義的內容,傳回指定之中繼資料語彙基元所識別的型別。Returns the type identified by the specified metadata token, in the context defined by the specified generic type parameters.

SetCustomAttribute(ConstructorInfo, Byte[])

將自訂屬性套用至這個模組,方式是使用指定的二進位大型物件 (BLOB) 表示該屬性。Applies a custom attribute to this module by using a specified binary large object (BLOB) that represents the attribute.

SetCustomAttribute(CustomAttributeBuilder)

使用自訂屬性產生器,將自訂屬性套用至這個模組。Applies a custom attribute to this module by using a custom attribute builder.

SetSymCustomAttribute(String, Byte[])

這個方法不會有任何作用。This method does nothing.

SetUserEntryPoint(MethodInfo)

設定使用者進入點。Sets the user entry point.

ToString()

傳回模組名稱。Returns the name of the module.

(繼承來源 Module)

明確介面實作

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

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。Maps a set of names to a corresponding set of dispatch identifiers.

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

擷取物件的類型資訊,可以用來取得介面的類型資訊。Retrieves the type information for an object, which can then be used to get the type information for an interface.

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

擷取物件提供的類型資訊介面數目 (0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

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

提供物件所公開的屬性和方法的存取權。Provides access to properties and methods exposed by an object.

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

如需這個成員的說明,請參閱 GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)For a description of this member, see GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr).

_ModuleBuilder.GetTypeInfo(UInt32, UInt32, IntPtr)

如需這個成員的說明,請參閱 GetTypeInfo(UInt32, UInt32, IntPtr)For a description of this member, see GetTypeInfo(UInt32, UInt32, IntPtr).

_ModuleBuilder.GetTypeInfoCount(UInt32)

如需這個成員的說明,請參閱 GetTypeInfoCount(UInt32)For a description of this member, see GetTypeInfoCount(UInt32).

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

如需這個成員的說明,請參閱 Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)For a description of this member, see Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr).

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

擴充方法

GetCustomAttribute(Module, Type)

擷取指定型別的自訂屬性,此屬性套用至指定模組。Retrieves a custom attribute of a specified type that is applied to a specified module.

GetCustomAttribute<T>(Module)

擷取指定型別的自訂屬性,此屬性套用至指定模組。Retrieves a custom attribute of a specified type that is applied to a specified module.

GetCustomAttributes(Module)

擷取套用至指定模組的自訂屬性集合。Retrieves a collection of custom attributes that are applied to a specified module.

GetCustomAttributes(Module, Type)

擷取指定型別的自訂屬性集合,此集合套用至指定模組。Retrieves a collection of custom attributes of a specified type that are applied to a specified module.

GetCustomAttributes<T>(Module)

擷取指定型別的自訂屬性集合,此集合套用至指定模組。Retrieves a collection of custom attributes of a specified type that are applied to a specified module.

IsDefined(Module, Type)

指出是否將所指定型別的自訂屬性套用至指定的模組。Indicates whether custom attributes of a specified type are applied to a specified module.

GetModuleVersionId(Module)
HasModuleVersionId(Module)

適用於