Class CommandlineBinder
Type specific command line argument binder
Inheritance
Inherited Members
Namespace: Ubiquity.CommandlineParsing
Assembly: Ubiquity.CommandlineParsing.dll
Syntax
public class CommandlineBinder
Remarks
Switches are matched against properties by an implementation of IOptionPropertyProvider to provide the properties. If no property name matches the command line switch, then a property with a CommandlineArgAttribute ShortName or LongName matching the switch is used. Duplicate switches are allowed if the property the option is bound to implements IList<T>
Property values are set by using a TypeConverter associated with the property. Using converters allows for a class to support custom parsing of values (e.g. GUID values can be parsed directly to a GUID type). Custom types with a defined TypeConverter will support parsing to custom types.
Positional arguments are stored into an IList<T> of strings, which must be designated by the DefaultPropertyAttribute on the class of the instance the arguments are bound to. If no default property or an unsupported type exists for the property and positional arguments are provided an exception is thrown.
Constructors
CommandlineBinder() | Initializes a new instance of the CommandlineBinder class using ReflectionOptionPropertyProvideras the property provider |
CommandlineBinder(IOptionPropertyProvider) | Initializes a new instance of the CommandlineBinder class for a given object instance |
Methods
BindParseResults(Object, IImmutableList<ICommandlineArgument>) | Binds a previously parsed list of arguments to an object instance |