Table of Contents

Class OptionAttribute

Namespace
McMaster.Extensions.CommandLineUtils
Assembly
McMaster.Extensions.CommandLineUtils.dll

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

[AttributeUsage(AttributeTargets.Property)]
public sealed class OptionAttribute : OptionAttributeBase
Inheritance
object
Attribute
OptionAttribute
Inherited Members

Constructors

OptionAttribute()

Initializes a new OptionAttribute.

public OptionAttribute()

OptionAttribute(CommandOptionType)

Initializes a new OptionAttribute.

public OptionAttribute(CommandOptionType optionType)

Parameters

optionType CommandOptionType

The optionType

OptionAttribute(string)

Initializes a new OptionAttribute.

public OptionAttribute(string template)

Parameters

template string

The string template. This is parsed into ShortName and LongName.

OptionAttribute(string, CommandOptionType)

Initializes a new OptionAttribute.

public OptionAttribute(string template, CommandOptionType optionType)

Parameters

template string

The template

optionType CommandOptionType

The option type

OptionAttribute(string?, string?, CommandOptionType)

Initializes a new OptionAttribute.

public OptionAttribute(string? template, string? description, CommandOptionType optionType)

Parameters

template string

The template

description string

The option description

optionType CommandOptionType

The option type

Properties

OptionType

Defines the type of the option. When not set, this will be inferred from the CLR type of the property.

public CommandOptionType? OptionType { get; set; }

Property Value

CommandOptionType?
See Also