Expression.Catch 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 CatchBlock 一個表示捕捉陳述的符號。
多載
| 名稱 | Description |
|---|---|
| Catch(ParameterExpression, Expression) |
建立 CatchBlock 一個表示捕捉(catch)陳述句的,並引用捕捉到的 Exception 物件,供處理程序本體使用。 |
| Catch(Type, Expression) |
建立 CatchBlock 一個表示捕捉陳述的符號。 |
| Catch(ParameterExpression, Expression, Expression) |
建立 CatchBlock 一個表示捕捉陳述句的過濾器 Exception 及捕捉物件的參考 Exception 。 |
| Catch(Type, Expression, Expression) |
建立 CatchBlock 一個帶有 Exception 過濾器但不參考捕捉 Exception 物件的 catch 陳述式。 |
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
A ParameterExpression 代表該處理器捕捉的物件的參考 Exception 。
- body
- Expression
捕捉陳述的正文。
傳回
被創造 CatchBlock的。
適用於
Catch(Type, Expression)
建立 CatchBlock 一個表示捕捉陳述的符號。
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
這Type會ExceptionCatchBlock處理得很好。
- body
- Expression
捕捉陳述的正文。
傳回
被創造 CatchBlock的。
備註
Type可指定 要捕捉的 ,Exception但無法Exception在 中引用該物件CatchBlock。
適用於
Catch(ParameterExpression, Expression, Expression)
建立 CatchBlock 一個表示捕捉陳述句的過濾器 Exception 及捕捉物件的參考 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);
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
A ParameterExpression 代表該處理器捕捉的物件的參考 Exception 。
- body
- Expression
捕捉陳述的正文。
- filter
- Expression
過濾器的 Exception 本體。
傳回
被創造 CatchBlock的。
適用於
Catch(Type, Expression, Expression)
建立 CatchBlock 一個帶有 Exception 過濾器但不參考捕捉 Exception 物件的 catch 陳述式。
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
參數
- type
- Type
這Type會ExceptionCatchBlock處理得很好。
- body
- Expression
捕捉陳述的正文。
- filter
- Expression
過濾器的 Exception 本體。
傳回
被創造 CatchBlock的。