Class OptionAttribute
Represents one or many command line option that is identified by flag proceeded by '-' or '--'. Options are not positional. Compare to ArgumentAttribute.
Inherited Members
Namespace: McMaster.Extensions.CommandLineUtils
Assembly: McMaster.Extensions.CommandLineUtils.dll
Syntax
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class OptionAttribute : OptionAttributeBase
Constructors
| Improve this Doc View SourceOptionAttribute()
Initializes a new OptionAttribute.
Declaration
public OptionAttribute()
OptionAttribute(CommandOptionType)
Initializes a new OptionAttribute.
Declaration
public OptionAttribute(CommandOptionType optionType)
Parameters
Type | Name | Description |
---|---|---|
CommandOptionType | optionType | The optionType |
OptionAttribute(String)
Initializes a new OptionAttribute.
Declaration
public OptionAttribute(string template)
Parameters
Type | Name | Description |
---|---|---|
System.String | template | The string template. This is parsed into ShortName and LongName. |
OptionAttribute(String, CommandOptionType)
Initializes a new OptionAttribute.
Declaration
public OptionAttribute(string template, CommandOptionType optionType)
Parameters
Type | Name | Description |
---|---|---|
System.String | template | The template |
CommandOptionType | optionType | The option type |
OptionAttribute(String, String, CommandOptionType)
Initializes a new OptionAttribute.
Declaration
public OptionAttribute(string template, string description, CommandOptionType optionType)
Parameters
Type | Name | Description |
---|---|---|
System.String | template | The template |
System.String | description | The option description |
CommandOptionType | optionType | The option type |
Properties
| Improve this Doc View SourceOptionType
Defines the type of the option. When not set, this will be inferred from the CLR type of the property.
Declaration
public CommandOptionType? OptionType { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<CommandOptionType> |