OpCodes.Ldtoken 字段

定义

将元数据标记转换为其运行时表示形式,并将其推送到计算堆栈上。Converts a metadata token to its runtime representation, pushing it onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Ldtoken;
public static readonly System.Reflection.Emit.OpCode Ldtoken;
 staticval mutable Ldtoken : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldtoken As OpCode 

字段值

注解

下表列出了指令的十六进制和 Microsoft 中间语言(MSIL)程序集格式以及简短的参考摘要:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

格式Format 程序集格式Assembly Format 说明Description
D0 < T >D0 < T > ldtoken tokenldtoken token 将元数据标记转换为其运行时表示形式。Converts a metadata token to its runtime representation.

堆栈转换行为顺序如下:The stack transitional behavior, in sequential order, is:

  1. 传递的标记将转换为 @no__t 0 并推送到堆栈上。The passed token is converted to a RuntimeHandle and pushed onto the stack.

@No__t-0 指令为指定的元数据标记推送 @no__t 1。The ldtoken instruction pushes a RuntimeHandle for the specified metadata token. @No__t-0 可以是 @no__t、@no__t 或 @no__t 3。A RuntimeHandle can be a fieldref/fielddef, a methodref/methoddef, or a typeref/typedef.

在堆栈上推送的值可用于对系统类库中 Reflection 方法的调用。The value pushed on the stack can be used in calls to Reflection methods in the system class library.

有关运行时句柄的信息,请参阅以下类: RuntimeFieldHandleRuntimeTypeHandleRuntimeMethodHandleFor information on runtime handles, see the following classes: RuntimeFieldHandle, RuntimeTypeHandle, and RuntimeMethodHandle.

以下 Emit 方法重载可以使用 @no__t 操作码:The following Emit method overloads can use the ldtoken opcode:

  • ILGenerator (操作码,MethodInfo)ILGenerator.Emit(OpCode, MethodInfo)

  • ILGenerator (OpCode,FieldInfo)ILGenerator.Emit(OpCode, FieldInfo)

  • ILGenerator (OpCode,Type)ILGenerator.Emit(OpCode, Type)

适用于