Interface IOptionProperty
- Namespace
- Ubiquity.CommandLineParsing
- Assembly
- Ubiquity.CommandlineParsing.dll
Interface for a property that binds a CommandLineOption to a property on an object instance.
public interface IOptionProperty
- Extension Methods
Properties
AllowSpaceDelimitedValue
Gets a value indicating whether this property allows a space delimited value.
bool AllowSpaceDelimitedValue { get; }
Property Value
Remarks
The parser, intentionally, doesn't have knowledge of the semantics of an application's choices for using a space as the delimiter between an option and it's value. This property informs the binder if it is allowed to consume an immediately following CommandLineValue as the value for this option. The implementation of, IOptionPropertyProvider normally retrieves this information from the AllowSpaceDelimitedValue attribute attached to the property this IOptionProperty represents though it can use whatever means is appropriate to the provider.
IsCollection
Gets a value indicating whether this property is a collection that accepts multiple values.
bool IsCollection { get; }
Property Value
IsSet
Gets a value indicating whether this property was set.
bool IsSet { get; }
Property Value
Remarks
If IsCollection is true then this must always be false. Otherwise, this is false until the first call to BindValue, after which it remains true. This is used to prevent setting the value multiple times.
Option
Gets the option to bind to this property.
CommandLineOption Option { get; }
Property Value
RequiresValue
Gets a value indicating whether this property requires a value.
bool RequiresValue { get; }
Property Value
Remarks
Most options require a value, though simple booleans don't as the presence or absence of the option are enough to determine the value.
Methods
BindValue()
Sets the value of the property from Option.
void BindValue()
BindValue(string)
Sets a value for the property when the option didn't have a value.
void BindValue(string newValue)
Parameters
newValue
stringNew value for the property.
Exceptions
- InvalidOperationException
If the Value is non-null or AllowSpaceDelimitedValue is false.