Expression.MakeCatchBlock(Type, ParameterExpression, Expression, Expression) 方法

定义

创建一个表示具有指定元素的 catch 语句的 CatchBlockCreates a CatchBlock representing a catch statement with the specified elements.

public:
 static System::Linq::Expressions::CatchBlock ^ MakeCatchBlock(Type ^ type, System::Linq::Expressions::ParameterExpression ^ variable, System::Linq::Expressions::Expression ^ body, System::Linq::Expressions::Expression ^ filter);
public static System.Linq.Expressions.CatchBlock MakeCatchBlock (Type type, System.Linq.Expressions.ParameterExpression variable, System.Linq.Expressions.Expression body, System.Linq.Expressions.Expression filter);
public static System.Linq.Expressions.CatchBlock MakeCatchBlock (Type type, System.Linq.Expressions.ParameterExpression? variable, System.Linq.Expressions.Expression body, System.Linq.Expressions.Expression? filter);
static member MakeCatchBlock : Type * System.Linq.Expressions.ParameterExpression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.CatchBlock
Public Shared Function MakeCatchBlock (type As Type, variable As ParameterExpression, body As Expression, filter As Expression) As CatchBlock

参数

type
Type

Type 将处理的 ExceptionCatchBlockThe Type of Exception this CatchBlock will handle.

variable
ParameterExpression

一个 ParameterExpression,它表示对此处理程序捕获的 Exception 对象的引用。A ParameterExpression representing a reference to the Exception object caught by this handler.

body
Expression

catch 语句的主体。The body of the catch statement.

filter
Expression

Exception 筛选器的主体。The body of the Exception filter.

返回

CatchBlock

创建的 CatchBlockThe created CatchBlock.

注解

type 如果) 提供,则必须为非 null,并且匹配 (的类型 variabletype must be non-null and match the type of variable (if it is supplied).

适用于