OpCodes.Endfilter 字段


将控制从异常的 filter 子句转移回公共语言结构 (CLI) 异常处理程序。Transfers control from the filter clause of an exception back to the Common Language Infrastructure (CLI) exception handler.

public: static initonly System::Reflection::Emit::OpCode Endfilter;
public static readonly System.Reflection.Emit.OpCode Endfilter;
 staticval mutable Endfilter : System.Reflection.Emit.OpCode
Public Shared ReadOnly Endfilter 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 11FE 11 执行 endfilterendfilter SEH 异常处理的结束筛选器子句。End filter clause of SEH exception handling.

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

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

  2. 从堆栈中弹出 value;执行 endfilter,并将控制传输到异常处理程序。value is popped from the stack; endfilter is executed and control is transferred to the exception handler.

Value (其类型必须为 int32,并且是从筛选子句返回的一组特定值)。Value (which must be of type int32 and is one of a specific set of values) is returned from the filter clause. 它应该是以下其中之一:It should be one of:

  • exception_continue_searchvalue = 0)以继续搜索异常处理程序exception_continue_search (value = 0) to continue searching for an exception handler

  • exception_execute_handlervalue = 1)以启动异常处理的第二个阶段,其中 finally 块将一直运行,直到找到与此筛选器子句关联的处理程序。exception_execute_handler (value = 1) to start the second phase of exception handling where finally blocks are run until the handler associated with this filter clause is located. 发现后,将执行处理程序。Upon discovery, the handler is executed.

其他整数值将产生未指定的结果。Other integer values will produce unspecified results.

筛选器的入口点(如方法的异常表中所示)必须是筛选器的代码块中的第一个指令。The entry point of a filter, as shown in the method's exception table, must be the first instruction in the filter's code block. @No__t-0 指令必须是筛选器的代码块中的最后一个指令(因此任何单个筛选器块只能有一个 endfilter)。The endfilter instruction must be the last instruction in the filter's code block (hence there can only be one endfilter for any single filter block). 执行 endfilter 指令后,控件将以逻辑方式流回 CLI 异常处理机制。After executing the endfilter instruction, control logically flows back to the CLI exception handling mechanism.

不能将控件传输到筛选器块中,除非通过异常机制。Control cannot be transferred into a filter block except through the exception mechanism. 不能通过使用 throw 指令或通过执行最后的 @no__t 1 指令来将控制转移出筛选器块。Control cannot be transferred out of a filter block except through the use of a throw instruction or by executing the final endfilter instruction. 不能将 @no__t 0 块嵌入到 @no__t 块中。You cannot embed a try block within a filter block. 如果在 filter 块内引发异常,则将被截获并返回值0(exception_continue_search)。If an exception is thrown inside the filter block, it is intercepted and a value of 0 (exception_continue_search) is returned.

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

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