Share via


CommandParameterAst Constructor

Definition

Construct a command parameter.

public:
 CommandParameterAst(System::Management::Automation::Language::IScriptExtent ^ extent, System::String ^ parameterName, System::Management::Automation::Language::ExpressionAst ^ argument, System::Management::Automation::Language::IScriptExtent ^ errorPosition);
public CommandParameterAst (System.Management.Automation.Language.IScriptExtent extent, string parameterName, System.Management.Automation.Language.ExpressionAst argument, System.Management.Automation.Language.IScriptExtent errorPosition);
new System.Management.Automation.Language.CommandParameterAst : System.Management.Automation.Language.IScriptExtent * string * System.Management.Automation.Language.ExpressionAst * System.Management.Automation.Language.IScriptExtent -> System.Management.Automation.Language.CommandParameterAst
Public Sub New (extent As IScriptExtent, parameterName As String, argument As ExpressionAst, errorPosition As IScriptExtent)

Parameters

extent
IScriptExtent

The extent of the parameter, starting from the dash character, ending at the end of the parameter name, or else at the end of the optional argument.

parameterName
String

The parameter name, without the leading dash and without the trailing colon, if a colon was used.

argument
ExpressionAst

If the parameter includes an argument with the syntax like -Path:a*, then the expression for 'a*' is passed as the argument. An argument is not required.

errorPosition
IScriptExtent

The extent to use for error reporting when parameter binding fails with this parameter. If argument is null, this extent is the same as extent, otherwise it is the extent of the parameter token itself.

Exceptions

If extent or parameterNameis null, or if parameterName is an empty string.

Applies to