Parameter Attribute

The Parameter attribute may be used to decorate a command's property to define a command parameter.

public Parameter(string parameterName=null, bool isRequired=true, int ordinalPosition=-1, string parameterSet=null, string autoCompleteValuesFunction=null, bool useAutoCompleteForValidation=false, string validationFunction=null)


The Parameter attribute exposes several properties, none of which are required.
  • ParameterName - the name of the parameter (what must be entered into the HostInterface to define the parameter on the command line - if this property is not set, the name of the parameter will be used
  • IsRequired - whether or not the parameter is required
  • OrdinalPosition - the ordinal position of the parameter
    • If the value is less than 1, it is undefined
    • All ordinal parameter definitions a command class must start with 1 and increase in an unbroken series (i.e., 1, 2, 3, 4, 5)
  • ParameterSet - the parameter set to which the parameter belongs - the value is undefined, then the parameter belongs does not belong to a parameter set
  • AutoCompleteValuesFunction - the function to invoke to return the auto complete values for the property
  • *UseAutoCompleteForValidation - if this is true, the values provided by the AutoCompleteValuesFunction will also be used to validate that the user has entered a valid value for the parameter
  • ValidationFunction - the function to invoke in order to validate the parameter value. This function is called when the command is invoked but before the Invoke function is invoked

see also Ordinal Parameters, Auto Complete Values Function, Validation Function, Parameter Sets

Last edited Jun 15, 2013 at 8:02 PM by jeffhewitt, version 6

Comments

No comments yet.