CommandLineArgumentAttributePosition Property

Gets or sets the position of a positional argument.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.0.0
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.

If you have arguments defined by the type's constructor parameters, positional arguments defined by properties will always come after them; for example, if you have two constructor parameter arguments and one property positional argument with position 0, then that argument will actually be the third positional argument.

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

See Also