Expression.MakeTry 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 TryExpression 一個代表 try 區塊的指定元素。
public:
static System::Linq::Expressions::TryExpression ^ MakeTry(Type ^ type, System::Linq::Expressions::Expression ^ body, System::Linq::Expressions::Expression ^ finally, System::Linq::Expressions::Expression ^ fault, System::Collections::Generic::IEnumerable<System::Linq::Expressions::CatchBlock ^> ^ handlers);
public static System.Linq.Expressions.TryExpression MakeTry(Type type, System.Linq.Expressions.Expression body, System.Linq.Expressions.Expression finally, System.Linq.Expressions.Expression fault, System.Collections.Generic.IEnumerable<System.Linq.Expressions.CatchBlock> handlers);
public static System.Linq.Expressions.TryExpression MakeTry(Type? type, System.Linq.Expressions.Expression body, System.Linq.Expressions.Expression? finally, System.Linq.Expressions.Expression? fault, System.Collections.Generic.IEnumerable<System.Linq.Expressions.CatchBlock>? handlers);
static member MakeTry : Type * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * seq<System.Linq.Expressions.CatchBlock> -> System.Linq.Expressions.TryExpression
Public Shared Function MakeTry (type As Type, body As Expression, finally As Expression, fault As Expression, handlers As IEnumerable(Of CatchBlock)) As TryExpression
參數
- type
- Type
嘗試表達式的結果類型。 若為空,主體與所有處理器必須具有相同的型別。
- body
- Expression
達陣阻擋的身體。
- finally
- Expression
最後一個方塊的身體。 如果 try 區塊沒有 final 區塊,則 pass null。
- fault
- Expression
斷層塊的本體。 如果 try 區塊沒有錯誤區塊,就傳 null。
- handlers
- IEnumerable<CatchBlock>
一組 CatchBlocks 代表要與 try 區塊相關聯的 catch 語句。
傳回
被創造 TryExpression的。