Edit

Share via


Expression.Catch Method

Definition

Creates a CatchBlock representing a catch statement.

Overloads

Catch(ParameterExpression, Expression)

Creates a CatchBlock representing a catch statement with a reference to the caught Exception object for use in the handler body.

Catch(Type, Expression)

Creates a CatchBlock representing a catch statement.

Catch(ParameterExpression, Expression, Expression)

Creates a CatchBlock representing a catch statement with an Exception filter and a reference to the caught Exception object.

Catch(Type, Expression, Expression)

Creates a CatchBlock representing a catch statement with an Exception filter but no reference to the caught Exception object.

Catch(ParameterExpression, Expression)

Source:
CatchBlock.cs
Source:
CatchBlock.cs
Source:
CatchBlock.cs

Creates a CatchBlock representing a catch statement with a reference to the caught Exception object for use in the handler body.

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

Parameters

variable
ParameterExpression

A ParameterExpression representing a reference to the Exception object caught by this handler.

body
Expression

The body of the catch statement.

Returns

The created CatchBlock.

Applies to

Catch(Type, Expression)

Source:
CatchBlock.cs
Source:
CatchBlock.cs
Source:
CatchBlock.cs

Creates a CatchBlock representing a catch statement.

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

Parameters

type
Type

The Type of Exception this CatchBlock will handle.

body
Expression

The body of the catch statement.

Returns

The created CatchBlock.

Remarks

The Type of Exception to be caught can be specified but no reference to the Exception object will be available for use in the CatchBlock.

Applies to

Catch(ParameterExpression, Expression, Expression)

Source:
CatchBlock.cs
Source:
CatchBlock.cs
Source:
CatchBlock.cs

Creates a CatchBlock representing a catch statement with an Exception filter and a reference to the caught Exception object.

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);
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

Parameters

variable
ParameterExpression

A ParameterExpression representing a reference to the Exception object caught by this handler.

body
Expression

The body of the catch statement.

filter
Expression

The body of the Exception filter.

Returns

The created CatchBlock.

Applies to

Catch(Type, Expression, Expression)

Source:
CatchBlock.cs
Source:
CatchBlock.cs
Source:
CatchBlock.cs

Creates a CatchBlock representing a catch statement with an Exception filter but no reference to the caught Exception object.

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);
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

Parameters

type
Type

The Type of Exception this CatchBlock will handle.

body
Expression

The body of the catch statement.

filter
Expression

The body of the Exception filter.

Returns

The created CatchBlock.

Applies to