Expression.Catch 方法

定义

创建一个 CatchBlock 表示 catch 语句。

重载

名称 说明
Catch(ParameterExpression, Expression)

创建一个 CatchBlock 表示 catch 语句,其中包含对捕获 Exception 对象的引用,以便在处理程序正文中使用。

Catch(Type, Expression)

创建一个 CatchBlock 表示 catch 语句。

Catch(ParameterExpression, Expression, Expression)

创建一个 CatchBlock 表示具有筛选器的 Exception catch 语句和对捕获 Exception 对象的引用。

Catch(Type, Expression, Expression)

创建一个 CatchBlock 表示具有 Exception 筛选器的 catch 语句,但不引用捕获 Exception 的对象。

Catch(ParameterExpression, Expression)

创建一个 CatchBlock 表示 catch 语句,其中包含对捕获 Exception 对象的引用,以便在处理程序正文中使用。

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

参数

variable
ParameterExpression

表示 ParameterExpression 对此处理程序捕获的对象的引用 Exception

body
Expression

catch 语句的正文。

返回

创建的 CatchBlock

适用于

Catch(Type, Expression)

创建一个 CatchBlock 表示 catch 语句。

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

参数

type
Type

Exception这将Type处理。CatchBlock

body
Expression

catch 语句的正文。

返回

创建的 CatchBlock

注解

Type可以指定捕获对象,Exception但不能在对象中使用CatchBlock任何引用Exception

适用于

Catch(ParameterExpression, Expression, Expression)

创建一个 CatchBlock 表示具有筛选器的 Exception catch 语句和对捕获 Exception 对象的引用。

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

参数

variable
ParameterExpression

表示 ParameterExpression 对此处理程序捕获的对象的引用 Exception

body
Expression

catch 语句的正文。

filter
Expression

筛选器的 Exception 正文。

返回

创建的 CatchBlock

适用于

Catch(Type, Expression, Expression)

创建一个 CatchBlock 表示具有 Exception 筛选器的 catch 语句,但不引用捕获 Exception 的对象。

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

参数

type
Type

Exception这将Type处理。CatchBlock

body
Expression

catch 语句的正文。

filter
Expression

筛选器的 Exception 正文。

返回

创建的 CatchBlock

适用于