OpCodes.Stloc_1 字段


从计算堆栈的顶部弹出当前值并将其存储到索引 1 处的局部变量列表中。Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 1.

public: static initonly System::Reflection::Emit::OpCode Stloc_1;
public static readonly System.Reflection.Emit.OpCode Stloc_1;
 staticval mutable Stloc_1 : System.Reflection.Emit.OpCode
Public Shared ReadOnly Stloc_1 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
0B0B stloc.1stloc.1 将值从堆栈中弹出到局部变量1中。Pops a value from the stack into local variable 1.

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

  1. 从堆栈中弹出一个值,并将其放入索引为1的局部变量。A value is popped off of the stack and placed in the local variable indexed by 1.

@No__t-0 指令从计算堆栈中弹出顶部值,并将其移动到索引为1的局部变量。The stloc.1 instruction pops the top value off the evaluation stack and moves it into the local variable indexed by 1. 值的类型必须与当前方法本地签名中指定的局部变量的类型匹配。The type of the value must match the type of the local variable as specified in the current method's local signature.

stloc.1 是在局部变量1中存储值的一种非常有效的编码。stloc.1 is an especially efficient encoding for storing values in local variable 1.

如果存储在保持小于4个字节的整数值的局部变量中,长时间将在从堆栈移到局部变量时截断值。Storing into locals that hold an integer value smaller than 4 bytes long truncates the value as it moves from the stack to the local variable. 浮点值从其本机大小(类型 F)舍入到与参数相关联的大小。Floating-point values are rounded from their native size (type F) to the size associated with the argument.

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

  • ILGenerator.Emit(OpCode)ILGenerator.Emit(OpCode)