Option<T> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A symbol defining a named parameter and a value for that parameter.
generic <typename T>
public ref class Option : System::CommandLine::Option
generic <typename T>
public ref class Option : System::CommandLine::Option, System::CommandLine::Binding::IValueDescriptor<T>
public class Option<T> : System.CommandLine.Option
public class Option<T> : System.CommandLine.Option, System.CommandLine.Binding.IValueDescriptor<T>
type Option<'T> = class
inherit Option
type Option<'T> = class
inherit Option
interface IValueDescriptor<'T>
interface IValueDescriptor
Public Class Option(Of T)
Inherits Option
Public Class Option(Of T)
Inherits Option
Implements IValueDescriptor(Of T)
Type Parameters
- T
The Type that the option's arguments are expected to be parsed as.
- Inheritance
- Inheritance
- Implements
Constructors
| Option<T>(String, Func<T>, String) |
Initializes a new instance of the Option<T> class. |
| Option<T>(String, ParseArgument<T>, Boolean, String) |
Initializes a new instance of the Option<T> class. |
| Option<T>(String, String) |
Initializes a new instance of the IdentifierSymbol class. |
| Option<T>(String, String[]) |
Initializes a new instance of the Option class. |
| Option<T>(String[], Func<T>, String) |
Initializes a new instance of the Option<T> class. |
| Option<T>(String[], ParseArgument<T>, Boolean, String) |
Initializes a new instance of the Option<T> class. |
| Option<T>(String[], String) |
Initializes a new instance of the Option<T> class. |
Properties
| Action |
Gets or sets the CommandLineAction for the Option. The handler represents the action that will be performed when the Option is invoked. (Inherited from Option) |
| Aliases |
Gets the unique set of strings that can be used on the command line to specify the Option. (Inherited from Option) |
| AllowMultipleArgumentsPerToken |
Gets a value that indicates whether multiple argument tokens are allowed for each option identifier token. (Inherited from Option) |
| ArgumentHelpName |
Gets or sets the name of the argument when displayed in help. (Inherited from Option) |
| Arity |
Gets or sets the arity of the option. |
| Arity |
Gets or sets the arity of the option. (Inherited from Option) |
| CompletionSources |
Gets the list of completion sources for the option. (Inherited from Option) |
| CustomParser |
A custom argument parser. |
| DefaultValueFactory |
The delegate to invoke to create the default value. |
| Description |
Gets or sets the description of the symbol. (Inherited from Symbol) |
| HasDefaultValue |
Specifies if a default value is defined for the option. (Inherited from Option) |
| HelpName |
Gets or sets the name of the Option when displayed in help. (Inherited from Option) |
| Hidden |
Gets or sets a value indicating whether the symbol is hidden. (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. (Inherited from Option) |
| Name |
Gets or sets the symbol name. (Inherited from Option) |
| Parents |
Gets the parent symbols. (Inherited from Symbol) |
| Recursive |
When set to true, this option will be applied to its immediate parent command or commands and recursively to their subcommands. (Inherited from Option) |
| Required |
Indicates whether the option is required when its parent command is invoked. (Inherited from Option) |
| Validators |
Validators that will be called when the option is matched by the parser. (Inherited from Option) |
| ValueType |
The type of the value. |
| ValueType |
Gets the Type that the option's parsed tokens will be converted to. (Inherited from Option) |
Methods
| AcceptLegalFileNamesOnly() |
Configures the option to accept only values representing legal file names. |
| AcceptLegalFilePathsOnly() |
Configures the option to accept only values representing legal file paths. |
| AcceptOnlyFromAmong(String[]) |
Configures the option to accept only the specified values, and to suggest them as command line completions. |
| 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. (Inherited from Option) |
| GetCompletions() |
Gets completions for the symbol. (Inherited from Symbol) |
| GetCompletions(CompletionContext) |
Gets completions for the symbol. (Inherited from Option) |
| GetDefaultValue() |
Gets the default value for the option. (Inherited from Option) |
| HasAlias(String) |
Determines whether the specified alias has already been defined. (Inherited from IdentifierSymbol) |
| HasAliasIgnoringPrefix(String) |
Indicates whether a given alias exists on the option, regardless of its prefix. (Inherited from Option) |
| SetDefaultValue(Object) |
Sets the default value for the option. (Inherited from Option) |
| SetDefaultValueFactory(Func<Object>) |
Sets a delegate to invoke when the default value for the option is required. (Inherited from Option) |
| ToString() |
Returns a string that represents the current object. (Inherited from Symbol) |
Explicit Interface Implementations
| IValueDescriptor.GetDefaultValue() |
Gets the default value, if any. (Inherited from Option) |
| IValueDescriptor.HasDefaultValue |
Gets a value that indicates whether there is a default value. (Inherited from Option) |
| IValueDescriptor.ValueName |
Gets the name of the value. (Inherited from Option) |
Extension Methods
| ExistingOnly<T>(Option<T>) |
Configures an option to accept only values corresponding to a existing files or directories. |
| Parse(Option, String) |
Parses a command line string value using an option. |
| Parse(Option, String[]) |
Parses a command line string value using an option. |
| AcceptExistingOnly<T>(Option<T>) |
Configures an option to accept only values corresponding to a existing files or directories. |