CommandInfoCreateInstanceWithResult 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  ReadOnlyMemoryString
The arguments to the command.

Return Value

ValueTupleICommand, ParseResult
A tuple containing an instance of the CommandType, or 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 ICommandWithCustomParsingParse(ReadOnlyMemoryString, CommandManager) method invoked. Otherwise, an instance of the type is created using the CommandLineParser class.

The ParseResultStatus property of the returned ParseResult will be ParseStatusNone if the command used custom parsing.

See Also