ParseOptionsAttribute.DuplicateArguments Property

Gets or sets a value indicating whether duplicate arguments are allowed.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 5.0.0+724ca9b7fa5edc075ec2ae65044e61b0d494fd1c
C#
public ErrorMode DuplicateArguments { get; set; }

Property Value

ErrorMode
One of the values of the ErrorMode enumeration. The default value is ErrorMode.Error.

Remarks

If set to ErrorMode.Error, supplying a non-multi-value argument more than once will cause an exception. If set to ErrorMode.Allow, the last value supplied will be used.

If set to ErrorMode.Warning, the CommandLineParser<T>.ParseWithErrorHandling() method, the static CommandLineParser.Parse<T>(ParseOptions) method, the generated IParser<TSelf>.Parse(ParseOptions) method, and the Ookii.CommandLine.Commands.CommandManager class will print a warning to the ParseOptions.Error stream when a duplicate argument is found. If you are not using these methods, ErrorMode.Warning is identical to ErrorMode.Allow and no warning is displayed. To manually display a warning, use the CommandLineParser.DuplicateArgument event.

This value can be overridden by the ParseOptions.DuplicateArguments property.

See Also