OpCodes.Initblk 字段


将位于特定地址的内存的指定块初始化为给定大小和初始值。Initializes a specified block of memory at a specific address to a given size and initial value.

public: static initonly System::Reflection::Emit::OpCode Initblk;
public static readonly System.Reflection.Emit.OpCode Initblk;
 staticval mutable Initblk : System.Reflection.Emit.OpCode
Public Shared ReadOnly Initblk 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 18FE 18 initblkinitblk 将内存块中的每个位置设置为给定值。Set each location in a block of memory to a given value.

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

  1. 起始地址被推送到堆栈上。A starting address is pushed onto the stack.

  2. 将初始化值推送到堆栈上。An initialization value is pushed onto the stack.

  3. 要初始化的字节数将被推送到堆栈上。The number of bytes to initialize is pushed onto the stack.

  4. 从堆栈中弹出字节数、初始化值和起始地址,并按它们的值执行初始化。The number of bytes, the initialization value, and the starting address are popped from the stack, and the initialization is performed as per their values.

@No__t-0 指令将从指定的地址(类型为 native int&*)开始的字节数(unsigned int32)设置为初始化值(类型为 unsigned int8)。The initblk instruction sets the number (unsigned int32) of bytes starting at the specified address (of type native int, &, or *) to the initialization value (of type unsigned int8). initblk 假设起始地址与计算机的自然大小对齐。initblk assumes that the starting address is aligned to the natural size of the machine.

紧靠前 @no__t 或 Unaligned 前缀指令可以更改 initblk 指令的操作。The operation of the initblk instructions can be altered by an immediately preceding Volatile or Unaligned prefix instruction.

如果检测到无效地址,则可能会引发 NullReferenceExceptionNullReferenceException may be thrown if an invalid address is detected.

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

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