CommandLineParserHelpRequested Property

Gets or sets a value that indicates whether usage help should be displayed if the Parse(String, Int32) method returned .

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.1.1
C#
public bool HelpRequested { get; set; }

Property Value

Boolean
if usage help should be displayed; otherwise, .

Remarks

Check this property after calling the Parse(String, Int32) method to see if usage help should be displayed.

This property will be if the Parse(String, Int32) method threw a CommandLineArgumentException, if an argument used CancelParsing, if parsing was canceled using the ArgumentParsed event.

If an argument that is defined by a method (Method) cancels parsing by returning from the method, this property is not automatically set to . Instead, the method should explicitly set the HelpRequested property if it wants usage help to be displayed.

C#
[CommandLineArgument]
public static bool MethodArgument(CommandLineParser parser)
{
    parser.HelpRequested = true;
    return false;
}

The HelpRequested property will always be if Parse(String, Int32) did not throw and returned a non-null value.

See Also