Skip to content

M_CommandLine_Parser_ParseArguments__1_1

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

Parser.ParseArguments(T) Method (Func(T), IEnumerable(String))

Parses a string array of command line arguments constructing values in an instance of type T. Grammar rules are defined decorating public properties with appropriate attributes.

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

Syntax

C#

public ParserResult<T> ParseArguments<T>(
	Func<T> factory,
	IEnumerable<string> args
)
where T : new()

VB

Public Function ParseArguments(Of T As New) ( 
	factory As Func(Of T),
	args As IEnumerable(Of String)
) As ParserResult(Of T)

C++

public:
generic<typename T>
where T : gcnew()
ParserResult<T>^ ParseArguments(
	Func<T>^ factory, 
	IEnumerable<String^>^ args
)

F#

member ParseArguments : 
        factory : Func<'T> * 
        args : IEnumerable<string> -> ParserResult<'T>  when 'T : new()

Parameters

 

factory
Type: System.Func(T)
A Func(TResult) delegate used to initialize the target instance.
args
Type: System.Collections.Generic.IEnumerable(String)
A String array of command line arguments, normally supplied by application entry point.

Type Parameters

 

T
Type of the target instance built with parsed value.

Return Value

Type: ParserResult(T)
A ParserResult(T) containing an instance of type T with parsed values and a sequence of Error.

Exceptions

 

Exception Condition
ArgumentNullException Thrown if one or more arguments are null.

See Also

Reference

Parser Class
ParseArguments Overload
CommandLine Namespace

Clone this wiki locally