CommandLineArgumentHasValue Property

Gets a value indicating whether the value of this argument was supplied on the command line in the last call to CommandLineParserParse(String).

Definition

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

Property Value

Boolean
if this argument's value was supplied on the command line when the arguments were parsed; otherwise, .

Remarks

Use this property to determine whether or not an argument was supplied on the command line, or was assigned its default value.

When an optional argument is not supplied on the command line, the Value property will be equal to the DefaultValue property, and HasValue will be .

It is however possible for the user to supply a value on the command line that matches the default value. In that case, although the Value property will still be equal to the DefaultValue property, the HasValue property will be . This allows you to distinguish between an argument that was supplied or omitted even if the supplied value matches the default.

See Also