CommandInfo.CreateInstanceWithResult Method

Creates an instance of the command type by parsing the specified arguments, and returns it in addition to the result of the parsing operation.

Definition

Namespace: Ookii.CommandLine.Commands
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public (ICommand , ParseResult ) CreateInstanceWithResult(
	ReadOnlyMemory<string> args
)

Parameters

args  ReadOnlyMemory<String>
The arguments to the command.

Return Value

ValueTuple<ICommand, ParseResult>
A tuple containing an instance of the CommandType, or null if an error occurred or parsing was canceled, and the ParseResult of the operation.

Remarks

If the type indicated by the CommandType property implements the ICommandWithCustomParsing parsing interface, an instance of the type is created and the ICommandWithCustomParsing.Parse(ReadOnlyMemory<String>, CommandManager) method invoked. Otherwise, an instance of the type is created using the CommandLineParser class.

The ParseResult.Status property of the returned ParseResult will be ParseStatus.None if the command used custom parsing.

See Also