OpCodes.Cpobj 字段


将位于对象(&native int 类型)地址的值类型复制到目标对象(&native int 类型)的地址。Copies the value type located at the address of an object (type &, or native int) to the address of the destination object (type &, or native int).

public: static initonly System::Reflection::Emit::OpCode Cpobj;
public static readonly System.Reflection.Emit.OpCode Cpobj;
 staticval mutable Cpobj : System.Reflection.Emit.OpCode
Public Shared ReadOnly Cpobj 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
70 < T >70 < T > cpobj classTokcpobj classTok 将值类型从源对象复制到目标对象。Copies a value type from a source object to a destination object.

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

  1. 目标对象引用被推送到堆栈上。The destination object reference is pushed onto the stack.

  2. 源对象引用被推送到堆栈上。The source object reference is pushed onto the stack.

  3. 从堆栈中弹出两个对象引用;将源对象地址的值类型复制到目标对象的地址。The two object references are popped from the stack; the value type at the address of the source object is copied to the address of the destination object.

如果源对象和目标对象引用不是指向类 @no__t 标记所表示的类的实例的指针(typereftypedef),或者 classTok 不表示值类型,则不指定 cpobj 的行为。The behavior of cpobj is unspecified if the source and destination object references are not pointers to instances of the class represented by the class token classTok (a typeref or typedef), or if classTok does not represent a value type.

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

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

  • ILGenerator (OpCode,Type)ILGenerator.Emit(OpCode, Type)