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
System.Attribute.Equals(System.Object)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetHashCode()
System.Attribute.IsDefaultAttribute()
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.Match(System.Object)
System.Attribute.TypeId
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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. McMaster.Extensions.CommandLineUtils.CommandOption.Template. |
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. OptionType
Declaration
public CommandOptionType? OptionType { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<CommandOptionType> |