OpCodes.Stelem_I4 字段

定义

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

public: static initonly System::Reflection::Emit::OpCode Stelem_I4;
public static readonly System.Reflection.Emit.OpCode Stelem_I4;
 staticval mutable Stelem_I4 : System.Reflection.Emit.OpCode
Public Shared ReadOnly Stelem_I4 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
9E9E stelem.i4stelem.i4 将所提供索引处的数组元素替换为堆栈上的 int32 值。Replaces an array element at the supplied index with the int32 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.

@No__t-0 指令将一维数组中的 @no__t 元素的值替换 array,并将 int32 值推送到堆栈上。The stelem.i4 instruction replaces the value of the element index in the one-dimensional array array with the int32 value pushed onto the stack.

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

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

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

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

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

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

适用于