Επεξεργασία

Κοινή χρήση μέσω


Option Class

Definition

A symbol defining a named parameter and a value for that parameter.

public ref class Option : System::CommandLine::IdentifierSymbol, System::CommandLine::Binding::IValueDescriptor
public class Option : System.CommandLine.IdentifierSymbol, System.CommandLine.Binding.IValueDescriptor
type Option = class
    inherit IdentifierSymbol
    interface IValueDescriptor
Public Class Option
Inherits IdentifierSymbol
Implements IValueDescriptor
Inheritance
Derived
Implements

Constructors

Option(String, String, Type, Func<Object>, ArgumentArity)

Initializes a new instance of the Option class.

Option(String[], String, Type, Func<Object>, ArgumentArity)

Initializes a new instance of the Option class.

Properties

Aliases

Gets the set of strings that can be used on the command line to specify the symbol.

(Inherited from IdentifierSymbol)
AllowMultipleArgumentsPerToken

Gets a value that indicates whether multiple argument tokens are allowed for each option identifier token.

ArgumentHelpName

Gets or sets the name of the argument when displayed in help.

Arity

Gets or sets the arity of the option.

Description

Gets or sets the description of the symbol.

(Inherited from Symbol)
IsHidden

Gets or sets a value indicating whether the symbol is hidden.

(Inherited from Symbol)
IsRequired

Indicates whether the option is required when its parent command is invoked.

Name

Gets or sets the symbol name.

Parents

Gets the parent symbols.

(Inherited from Symbol)
ValueType

The Type that the option's arguments are expected to be parsed as.

Methods

AddAlias(String)

Adds an alias.

(Inherited from IdentifierSymbol)
AddValidator(ValidateSymbolResult<OptionResult>)

Adds a validator that will be called when the option is matched by the parser.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetCompletions()

Gets completions for the symbol.

(Inherited from Symbol)
GetCompletions(CompletionContext)

Gets the suggested values for command line completion.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
HasAlias(String)

Determines whether the alias has already been defined.

(Inherited from IdentifierSymbol)
HasAliasIgnoringPrefix(String)

Indicates whether a given alias exists on the option, regardless of its prefix.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SetDefaultValue(Object)

Sets the default value for the option.

SetDefaultValueFactory(Func<Object>)

Sets a delegate to invoke when the default value for the option is required.

ToString()

Returns a string that represents the current object.

(Inherited from Symbol)

Explicit Interface Implementations

IValueDescriptor.GetDefaultValue()

Gets the default value, if any.

IValueDescriptor.HasDefaultValue

Gets a value that indicates whether there is a default value.

IValueDescriptor.ValueName

Gets the name of the value.

Extension Methods

Parse(Option, String)

Parses a command line string value using an option.

Parse(Option, String[])

Parses a command line string value using an option.

Applies to

See also