Share via


SwitchStatementAst Constructor

Definition

Construct a switch statement.

public:
 SwitchStatementAst(System::Management::Automation::Language::IScriptExtent ^ extent, System::String ^ label, System::Management::Automation::Language::PipelineBaseAst ^ condition, System::Management::Automation::Language::SwitchFlags flags, System::Collections::Generic::IEnumerable<Tuple<System::Management::Automation::Language::ExpressionAst ^, System::Management::Automation::Language::StatementBlockAst ^> ^> ^ clauses, System::Management::Automation::Language::StatementBlockAst ^ default);
public SwitchStatementAst (System.Management.Automation.Language.IScriptExtent extent, string label, System.Management.Automation.Language.PipelineBaseAst condition, System.Management.Automation.Language.SwitchFlags flags, System.Collections.Generic.IEnumerable<Tuple<System.Management.Automation.Language.ExpressionAst,System.Management.Automation.Language.StatementBlockAst>> clauses, System.Management.Automation.Language.StatementBlockAst default);
new System.Management.Automation.Language.SwitchStatementAst : System.Management.Automation.Language.IScriptExtent * string * System.Management.Automation.Language.PipelineBaseAst * System.Management.Automation.Language.SwitchFlags * seq<System.Management.Automation.Language.ExpressionAst * System.Management.Automation.Language.StatementBlockAst> * System.Management.Automation.Language.StatementBlockAst -> System.Management.Automation.Language.SwitchStatementAst
Public Sub New (extent As IScriptExtent, label As String, condition As PipelineBaseAst, flags As SwitchFlags, clauses As IEnumerable(Of Tuple(Of ExpressionAst, StatementBlockAst)), default As StatementBlockAst)

Parameters

extent
IScriptExtent

The extent of the statement, from the label or switch keyword to the closing curly.

label
String

The optionally null label.

condition
PipelineBaseAst

The expression being switched upon.

flags
SwitchFlags

Any flags that affect how the condition is tested.

clauses
IEnumerable<Tuple<ExpressionAst,StatementBlockAst>>

A possibly null or empty collection of conditions and block of statements to execute if the condition matches.

default
StatementBlockAst

The default clause to execute if no clauses match.

Exceptions

If extent is null.

If default and clauses are both null or empty.

Applies to