OpCodes.Ldelem_U2 字段

定义

将位于指定数组索引处的 unsigned int16 类型的元素作为 int32 加载到计算堆栈的顶部。Loads the element with type unsigned int16 at a specified array index onto the top of the evaluation stack as an int32.

public: static initonly System::Reflection::Emit::OpCode Ldelem_U2;
public static readonly System.Reflection.Emit.OpCode Ldelem_U2;
 staticval mutable Ldelem_U2 : System.Reflection.Emit.OpCode
Public Shared ReadOnly Ldelem_U2 As OpCode 

字段值

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
9393 ldelemldelem.u2 unsigned int16将位于索引处的类型的元素作为加载到堆栈顶部 int32Loads the element with type unsigned int16 at index onto the top of the stack as an int32.

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

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

  2. 索引值 index 被推送到堆栈上。An index value index is pushed onto the stack.

  3. indexarray 从堆栈中弹出和,并在中查找存储在位置的值 index arrayindex and array are popped from the stack; the value stored at position index in array is looked up.

  4. 值推送到堆栈上。The value is pushed onto the stack.

ldelem.u2指令在 index 从零开始的一维数组中加载具有索引 (类型) 的元素的值 native int array ,并将其放在堆栈顶部。The ldelem.u2 instruction loads the value of the element with index index (type native int) in the zero-based one-dimensional array array and places it on the top of the stack. 数组是对象,因此表示为类型的值 OArrays are objects and hence represented by a value of type O.

的返回值 ldelem.u2int16The return value for ldelem.u2 is int16.

请注意,小于4个字节的整数值将扩展到在将 int32 native int 其加载到计算堆栈上时不) (。Note that integer values of less than 4 bytes are extended to int32 (not native int) when they are loaded onto the evaluation stack.

NullReferenceException 如果 array 为 null 引用,则引发。NullReferenceException is thrown if array is a null reference.

ArrayTypeMismatchException 如果不 array 包含所需类型的元素,则引发。ArrayTypeMismatchException is thrown if array does not hold elements of the required type.

IndexOutOfRangeException 如果 index 为负或大于的界限,则引发 arrayIndexOutOfRangeException is thrown if index is negative, or larger than the bound of array.

以下 Emit 方法重载可以使用 ldelem.u2 操作码:The following Emit method overload can use the ldelem.u2 opcode:

适用于