OpCodes.Starg 字段

定义

将位于计算堆栈顶部的值存储到位于指定索引的自变量槽中。Stores the value on top of the evaluation stack in the argument slot at a specified index.

public: static initonly System::Reflection::Emit::OpCode Starg;
public static readonly System.Reflection.Emit.OpCode Starg;
 staticval mutable Starg : System.Reflection.Emit.OpCode
Public Shared ReadOnly Starg 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 0B < unsigned int16 @ NO__T-1FE 0B < unsigned int16 > starg numstarg num 从堆栈中弹出顶部值并将其存储在参数槽中 numPops the top value from the stack and stores it in argument slot num.

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

  1. 将弹出当前位于堆栈顶部的值并将其放入参数槽位 numThe value currently on top of the stack is popped and placed in argument slot num.

@No__t-0 指令从堆栈中弹出一个值,并将其放在参数槽 num 中。The starg instruction pops a value from the stack and places it in argument slot num. 值的类型必须与当前方法的签名中指定的参数的类型匹配。The type of the value must match the type of the argument, as specified in the current method's signature.

对于采用变量参数列表的过程,只能将 starg 指令用于初始固定参数,而不能用于签名的变量部分。For procedures that take a variable argument list, the starg instruction can be used only for the initial fixed arguments, not those in the variable part of the signature.

如果将存储区的参数保留为小于4个字节的整数值,则会在从堆栈移到参数时截断值。Performing a store into arguments that hold an integer value smaller than 4 bytes long truncates the value as it moves from the stack to the argument. 浮点值从其本机大小(类型 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 starg opcode:

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

适用于