Skip to content

M_CommandLine_Parser_ParseArguments

Moh.Hassan edited this page Oct 10, 2019 · 1 revision

Parser.ParseArguments Method (IEnumerable(String), Type[])

Parses a string array of command line arguments for verb commands scenario, constructing the proper instance from the array of types supplied by types. Grammar rules are defined decorating public properties with appropriate attributes. The VerbAttribute must be applied to types in the array.

Namespace: CommandLine
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

public ParserResult<Object> ParseArguments(
	IEnumerable<string> args,
	params Type[] types
)

VB

Public Function ParseArguments ( 
	args As IEnumerable(Of String),
	ParamArray types As Type()
) As ParserResult(Of Object)

C++

public:
ParserResult<Object^>^ ParseArguments(
	IEnumerable<String^>^ args, 
	... array<Type^>^ types
)

F#

member ParseArguments : 
        args : IEnumerable<string> * 
        types : Type[] -> ParserResult<Object> 

Parameters

 

args
Type: System.Collections.Generic.IEnumerable(String)
A String array of command line arguments, normally supplied by application entry point.
types
Type: System.Type[]
A Type array used to supply verb alternatives.

Return Value

Type: ParserResult(Object)
A ParserResult(T) containing the appropriate instance with parsed values as a Object and a sequence of Error.

Exceptions

 

Exception Condition
ArgumentNullException Thrown if one or more arguments are null.
ArgumentOutOfRangeException Thrown if types array is empty.

Remarks

All types must expose a parameterless constructor. It's strongly recommended to use a generic overload.

See Also

Reference

Parser Class
ParseArguments Overload
CommandLine Namespace

Clone this wiki locally