Język

Expression.MakeTry Metoda

Definicja

TryExpression Tworzy reprezentujący blok try z określonymi elementami.

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

Parametry

type
Type

Typ wyniku wyrażenia try. Jeśli wartość null, treść i wszystkie programy obsługi muszą mieć identyczny typ.

body
Expression

Treść bloku try.

finally
Expression

Treść ostatecznego bloku. Przekaż wartość null, jeśli blok try nie ma skojarzonego bloku w końcu.

fault
Expression

Treść bloku błędów. Przekaż wartość null, jeśli blok try nie ma skojarzonego bloku błędów.

handlers
IEnumerable<CatchBlock>

Kolekcja elementów reprezentujących instrukcje CatchBlockcatch, które mają być skojarzone z blokiem try.

Zwraca

Utworzony element TryExpression.

Dotyczy