다음을 통해 공유


TryStatementAst Constructor

Definition

Construct a try statement ast.

public:
 TryStatementAst(System::Management::Automation::Language::IScriptExtent ^ extent, System::Management::Automation::Language::StatementBlockAst ^ body, System::Collections::Generic::IEnumerable<System::Management::Automation::Language::CatchClauseAst ^> ^ catchClauses, System::Management::Automation::Language::StatementBlockAst ^ finally);
public TryStatementAst (System.Management.Automation.Language.IScriptExtent extent, System.Management.Automation.Language.StatementBlockAst body, System.Collections.Generic.IEnumerable<System.Management.Automation.Language.CatchClauseAst> catchClauses, System.Management.Automation.Language.StatementBlockAst finally);
new System.Management.Automation.Language.TryStatementAst : System.Management.Automation.Language.IScriptExtent * System.Management.Automation.Language.StatementBlockAst * seq<System.Management.Automation.Language.CatchClauseAst> * System.Management.Automation.Language.StatementBlockAst -> System.Management.Automation.Language.TryStatementAst
Public Sub New (extent As IScriptExtent, body As StatementBlockAst, catchClauses As IEnumerable(Of CatchClauseAst), finally As StatementBlockAst)

Parameters

extent
IScriptExtent

The extent of the try statement, from the try keyword to the closing curly of the last catch or finally.

body
StatementBlockAst

The region of guarded code.

catchClauses
IEnumerable<CatchClauseAst>

The list of catch clauses, may be null.

finally
StatementBlockAst

The finally clause, may be null.

Exceptions

If extent or body is null.

If catchClauses is null or is an empty collection and finally is also null, then an exception is also raised as the try block must have a finally or at least one catch.

Applies to