ParseResultExtensionsBind(ParseResult, Type) Method

Creates a new instance of the command definition class and binds/populates the properties from the parse result. Note that binding will be done only once per definition class, so calling this method consecutively for the same definition class will return the cached result.

If the command line input is not for the indicated definition class (e.g. it's for a sub-command but not for the indicated root command or vice versa), then the returned instance would be empty (i.e. properties would have default values).

Definition

Namespace: DotMake.CommandLine
Assembly: DotMake.CommandLine (in DotMake.CommandLine.dll) Version: 1.8.8
C#
public static Object Bind(
	this ParseResult parseResult,
	Type definitionType
)

Parameters

parseResult  ParseResult
A parse result describing the outcome of the parse operation.
definitionType  Type
The definition class type for the command. A command builder for this class should be automatically generated by the source generator.

Return Value

Object
An instance of the definition class whose properties were bound/populated from the parse result.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ParseResult. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also