OpCodes.Ldloca 字段


将位于特定索引处的局部变量的地址加载到计算堆栈上。Loads the address of the local variable at a specific index onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Ldloca;
public static readonly System.Reflection.Emit.OpCode Ldloca;
 staticval mutable Ldloca : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldloca 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
FE OD < unsigned int16 @ NO__T-1FE OD < unsigned int16 > ldloca indexldloca index index 处的局部变量的地址加载到计算堆栈上。Loads the address of the local variable at index onto the evaluation stack.

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

  1. 存储在本地变量中指定索引处的地址被推送到堆栈上。The address stored in the local variable at the specified index is pushed onto the stack.

@No__t-0 指令将传递的索引处的局部变量号的地址推送到堆栈上,其中局部变量从0开始编号。The ldloca instruction pushes the address of the local variable number at the passed index onto the stack, where local variables are numbered 0 onwards. 在堆栈上推送的值已正确对齐,以便与 Ldind_IStind_I 之类的指令一起使用。The value pushed on the stack is already aligned correctly for use with instructions like Ldind_I and Stind_I. 结果为暂时性指针(类型 *)。The result is a transient pointer (type *).

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

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