OpCodes.Ldarg 字段


将自变量(由指定索引值引用)加载到堆栈上。Loads an argument (referenced by a specified index value) onto the stack.

public: static initonly System::Reflection::Emit::OpCode Ldarg;
public static readonly System.Reflection.Emit.OpCode Ldarg;
 staticval mutable Ldarg : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldarg 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 09 < unsigned int16 >FE 09 < unsigned int16 > ldarg indexldarg index index 的参数加载到堆栈上。Load argument at index onto stack.

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

  1. index 的参数值推送到堆栈上。The argument value at index is pushed onto the stack.

@No__t-0 指令将索引处的参数推送到 index,其中自变量的索引从0开始,到计算堆栈上。The ldarg instruction pushes the argument indexed at index, where arguments are indexed from 0 onwards, onto the evaluation stack. @No__t 的指令可用于通过从传入参数复制来将值类型或基元值加载到堆栈上。The ldarg instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. 参数值的类型与参数的类型相同,后者由当前方法的签名指定。The type of the argument value is the same as the type of the argument, as specified by the current method's signature.

对于采用可变长度参数列表的过程,只能将 ldarg 指令用于初始固定参数,而不能用于签名中变量部分的参数(有关详细信息,请参阅 Arglist 指令)。For procedures that take a variable-length argument list, the ldarg instruction can be used only for the initial fixed arguments, not those in the variable part of the signature (see the Arglist instruction for more details).

保留小于4个字节的整数值的参数将在加载到堆栈上时展开为类型 int32Arguments that hold an integer value 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).

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

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