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

为此 Module 实例获取适当的 Assembly

(继承自 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__)定义属于值类型的枚举类型。

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)

在派生类中重写时,在可移植可执行 (PE) 文件的 .sdata 节中定义初始化的数据字段。

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)

定义要存储在此模块中的已命名托管嵌入资源。

DefineResource(String, String, ResourceAttributes)

用给定的特性定义存储在此模块中的已命名托管嵌入资源。

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)

在派生类中重写时,在可移植可执行文件 (PE) 文件的 .sdata 节中定义未初始化的数据字段。

DefineUnmanagedResource(Byte[])

已知不透明的字节二进制大对象 (BLOB),定义非托管嵌入资源。

DefineUnmanagedResource(String)

在给定 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 对象。 如果此程序集没有进行验证码签名,则返回 null

GetSignerCertificate()

返回与证书(包括在此模块所属的程序集的验证码签名中)对应的 X509Certificate 对象。 如果此程序集没有进行验证码签名,则返回 null

(继承自 Module)
GetStringConstant(String)

返回模块常量池中给定字符串的标记。

GetStringMetadataToken(String)

在派生类中重写时,返回给定 String 常量相对于 Module 的元数据标记。

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)

将一组名称映射为对应的一组调度标识符。

(继承自 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)

定义和表示动态程序集中的模块。

适用于