CommandLineArgumentAttributePosition Property

Gets or sets the relative position of a positional argument.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public int Position { get; set; }

Property Value

Int32
The position of the argument, or a negative value if the argument can only be specified by name. The default value is -1.

Remarks

The Position property specifies the relative position of the positional arguments created by properties. The actual numbers are not important, only their order is. For example, if you have two positional arguments with positions set to 4 and 7, and no other positional arguments, they will be the first and second positional arguments, not the forth and seventh. It is an error to use the same number more than once.

When using the GeneratedParserAttribute, you can also set the IsPositional property to , without setting the Position property, to order the positional arguments using the order of the members that define them.

If you set the Position property to a non-negative value, it is not necessary to set the IsPositional property.

The CommandLineArgumentPosition property will be set to reflect the actual position of the argument, which may not match the value of this property.

See Also