OpCodes.Brtrue 字段

定义

如果 valuetrue、非空或非零,则将控制转移到目标指令。Transfers control to a target instruction if value is true, not null, or non-zero.

public: static initonly System::Reflection::Emit::OpCode Brtrue;
public static readonly System.Reflection.Emit.OpCode Brtrue;
 staticval mutable Brtrue : System.Reflection.Emit.OpCode
Public Shared ReadOnly Brtrue 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
3A < int32 >3A < int32 > brtrue targetbrtrue target

brinst targetbrinst target
如果为非零值(true),则按指定的偏移量分支到目标指令。Branch to a target instruction at the specified offset if non-zero (true).

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

  1. 前一操作将 value 推送到堆栈上。value is pushed onto the stack by a previous operation.

  2. 从堆栈中弹出 value;如果 value @no__t 为-2,则分支到 @no__t。value is popped from the stack; if value is true, branch to target.

如果 value (类型 native int)为非零(true),则 brtrue 指令将控制转移到指定的目标指令。The brtrue instruction transfers control to the specified target instruction if value (type native int) is nonzero (true). 如果 @no__t 为零(false),则执行将在下一条指令继续。If value is zero (false) execution continues at the next instruction.

如果 value 是对象引用(键入 O),则 brinstbrtrue 的别名)将控制表示对象的实例(例如,如果它不是 null 对象引用,请参阅 Ldnull)。If value is an object reference (type O) then brinst (an alias for brtrue) transfers control if it represents an instance of an object (for example, if it is not the null object reference; see Ldnull).

目标指令表示为与当前指令后面的指令开头之间的4字节有符号偏移量。The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.

如果目标指令具有一个或多个前缀代码,则只能将控制转移到其中的第一个前缀。If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. 控制传入和传出 trycatchfilterfinally 块无法通过此说明执行。Control transfers into and out of try, catch, filter, and finally blocks cannot be performed by this instruction.

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

  • ILGenerator (操作码、标签)ILGenerator.Emit(OpCode, Label)

适用于