Search Results for

    Show / Hide Table of Contents

    Class OptionAttribute

    Represents one or many command line option that is identified by flag proceeded by '-' or '--'. Options are not positional. Compare to ArgumentAttribute.

    Inheritance
    System.Object
    System.Attribute
    OptionAttributeBase
    OptionAttribute
    Inherited Members
    OptionAttributeBase.Template
    OptionAttributeBase.ShortName
    OptionAttributeBase.LongName
    OptionAttributeBase.SymbolName
    OptionAttributeBase.ValueName
    OptionAttributeBase.Description
    OptionAttributeBase.ShowInHelpText
    OptionAttributeBase.Inherited
    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 Source

    OptionAttribute()

    Initializes a new OptionAttribute.

    Declaration
    public OptionAttribute()
    | Improve this Doc View Source

    OptionAttribute(CommandOptionType)

    Initializes a new OptionAttribute.

    Declaration
    public OptionAttribute(CommandOptionType optionType)
    Parameters
    Type Name Description
    CommandOptionType optionType

    The optionType

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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 Source

    OptionType

    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>
    See Also
    OptionType
    • Improve this Doc
    • View Source
    In This Article
    Back to top