OpCodes.Ldlen 字段


将从零开始的、一维数组的元素的数目推送到计算堆栈上。Pushes the number of elements of a zero-based, one-dimensional array onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Ldlen;
public static readonly System.Reflection.Emit.OpCode Ldlen;
 staticval mutable Ldlen : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldlen 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
8E8E ldlenldlen 将数组的长度(类型 natural unsigned int)推送到堆栈上。Pushes the length (of type natural unsigned int) of an array on the stack.

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

  1. 对数组的对象引用被推送到堆栈上。An object reference to an array is pushed onto the stack.

  2. 从堆栈中弹出数组引用并计算长度。The array reference is popped from the stack and the length is computed.

  3. 长度被推送到堆栈上。The length is pushed onto the stack.

数组是对象,因此由类型 O 的值表示。Arrays are objects and hence represented by a value of type O. 长度返回为 @no__t 0。The length is returned as a natural unsigned int.

如果数组引用为空引用,则会引发 NullReferenceExceptionNullReferenceException is thrown if the array reference is a null reference.

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

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