OpCodes.Ldloc_S 字段

定义

将特定索引处的局部变量加载到计算堆栈上(短格式)。Loads the local variable at a specific index onto the evaluation stack, short form.

public: static initonly System::Reflection::Emit::OpCode Ldloc_S;
public static readonly System.Reflection.Emit.OpCode Ldloc_S;
 staticval mutable Ldloc_S : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldloc_S 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
11 < unsigned int8 >11 < unsigned int8 > ldloc indexldloc.s index 将索引 index 处的局部变量加载到堆栈上(短格式)。Loads the local variable at index index onto stack, short form.

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

  1. 将指定索引处的本地变量值推送到堆栈上。The local variable value at the specified index is pushed onto the stack.

@No__t-0 指令将传递的索引处的局部变量数字的内容推送到计算堆栈上,其中本地变量从0开始编号。The ldloc.s instruction pushes the contents of the local variable number at the passed index onto the evaluation stack, where the local variables are numbered 0 onwards. 如果对方法的 initialize 标志为 true,则在输入方法之前,本地变量将初始化为0。Local variables are initialized to 0 before entering the method if the initialize flag on the method is true. 可以使用256(2 ^ 8)个本地变量(0-255),这是一个比 ldloc 更有效的编码。There are 256 (2^8) local variables possible (0-255) in the short form, which is a more efficient encoding than ldloc.

值的类型与在方法头中指定的局部变量的类型相同。The type of the value is the same as the type of the local variable, which is specified in the method header. 请参阅 Partition I. 小于4个字节的局部变量在加载到堆栈上时,将扩展为类型 int32See Partition I. Local variables that are smaller than 4 bytes long are expanded to type int32 when they are loaded onto the stack. 浮点值扩展为其本机大小(类型 F)。Floating-point values are expanded to their native size (type F).

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

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

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

适用于