CliCommandBuilderGetArgumentParserTCollection, TItem(FuncArray, TCollection, FuncString, TItem) Method

Gets an argument parser method for an argument type, if it's a collection type.

This is mainly used for adding support for all IEnumerableT compatible types which have a public constructor with a IEnumerableT or IListT parameter (other parameters, if any, should be optional).

Definition

Namespace: DotMake.CommandLine
Assembly: DotMake.CommandLine (in DotMake.CommandLine.dll) Version: 1.8.8
C#
public static Func<ArgumentResult, TCollection> GetArgumentParser<TCollection, TItem>(
	Func<Array, TCollection> convertFromArray,
	Func<string, TItem> convertFromString = null
)

Parameters

convertFromArray  FuncArray, TCollection
A delegate which creates an instance of collection type from an array.
convertFromString  FuncString, TItem  (Optional)
A delegate which creates an instance of item type from a string.

Type Parameters

TCollection
The collection type, the argument type itself.
TItem
The item type, e.g. if argument type is IEnumerable<T>, item type will be T.

Return Value

FuncArgumentResult, TCollection
A delegate which can be passed to an option or argument.

See Also