OpCodes.Dup 字段

定义

复制计算堆栈上当前最顶端的值,然后将副本推送到计算堆栈上。Copies the current topmost value on the evaluation stack, and then pushes the copy onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Dup;
public static readonly System.Reflection.Emit.OpCode Dup;
 staticval mutable Dup : System.Reflection.Emit.OpCode
Public Shared ReadOnly Dup 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
2525 dupdup 复制堆栈顶部的值。Duplicates the value on the top of the stack.

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

  1. value 推送到堆栈上。value is pushed onto the stack.

  2. 将从堆栈中弹出 @no__t,以进行复制。value is popped off of the stack for duplication.

  3. value 推送回堆栈上。value is pushed back onto the stack.

  4. 将重复的值推送到堆栈上。A duplicate value is pushed onto the stack.

@No__t-0 指令复制堆栈的顶部元素,并将两个相同的值放在其顶部。The dup instruction duplicates the top element of the stack, and leaves two identical values atop it.

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

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

适用于