OpCodes.Stelem_I2 字段


用计算堆栈上的 int16 值替换给定索引处的数组元素。Replaces the array element at a given index with the int16 value on the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Stelem_I2;
public static readonly System.Reflection.Emit.OpCode Stelem_I2;
 staticval mutable Stelem_I2 : System.Reflection.Emit.OpCode
Public Shared ReadOnly Stelem_I2 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
9D9D stelemstelem.i2 将所提供的索引处的数组元素替换为 int16 堆栈上的值。Replaces an array element at the supplied index with the int16 value on the stack.

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

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

  2. 将中元素的有效索引 array 推送到堆栈上。A valid index to an element in array is pushed onto the stack.

  3. 将值推送到堆栈上。A value is pushed onto the stack.

  4. 从堆栈中弹出值、索引和数组引用;将值放入给定索引处的数组元素。The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index.

stelem.i2指令 index arrayint16 推送到堆栈上的值替换一维数组中的元素的值。The stelem.i2 instruction replaces the value of the element index in the one-dimensional array array with the int16 value pushed onto the stack.

数组是对象,因此表示为类型的值 OArrays are objects and hence represented by a value of type O. 索引的类型为 native intThe index is type native int.

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

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

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

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