CommandLineParserTParseWithErrorHandling(String, Int32) Method

Parses the specified command line arguments, starting at the specified index, and displays error messages and usage help if required.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.1.1
C#
public T ParseWithErrorHandling(
	string[] args,
	int index = 0
)

Parameters

args  String
The command line arguments.
index  Int32  (Optional)
The index of the first argument to parse.

Return Value

T
An instance of the type specified by the ArgumentsType property, or if an error occurred, or argument parsing was canceled by the CancelParsing property or a method argument that returned .

Remarks

If an error occurs or parsing is canceled, it prints errors to the Error stream, and usage help to the UsageWriter if the HelpRequested property is . It then returns .

If the return value is , check the ParseResult property for more information about whether an error occurred or parsing was canceled.

This method will never throw a CommandLineArgumentException exception.

Exceptions

ArgumentNullExceptionargs is .
ArgumentOutOfRangeExceptionindex does not fall within the bounds of args.

See Also