CommandLineParserNameValueSeparator Property

Gets or sets the character used to separate the name and the value of an argument.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.1.1
C#
public char NameValueSeparator { get; }

Property Value

Char
The character used to separate the name and the value of an argument. The default value is the DefaultNameValueSeparator constant, a colon (:).

Remarks

This character is used to separate the name and the value if both are provided as a single argument to the application, e.g. -sample:value if the default value is used.

  Note

The character chosen here cannot be used in the name of any parameter. Therefore, it's usually best to choose a non-alphanumeric value such as the colon or equals sign. The character can appear in argument values (e.g. -sample:foo:bar is fine, in which case the value is "foo:bar").

  Note

Do not pick a whitespace character as the separator. Doing this only works if the whitespace character is part of the argument token, which usually means it needs to be quoted or escaped when invoking your application. Instead, use the AllowWhiteSpaceValueSeparator property to control whether whitespace is allowed as a separator.

Use the ParseOptions or ParseOptionsAttribute class to change this value.

See Also