Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Option<T> Class
Definition
- Namespace:
- System.CommandLine
- Assembly:
- System.CommandLine.dll
- Package:
- System.CommandLine v3.0.0-preview.5.26302.115
- Source:
- Option{T}.cs
- Source:
- Option{T}.cs
- Source:
- Option{T}.cs
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
public class Option<T> : System.CommandLine.Option
type Option<'T> = class
inherit Option
Public Class Option(Of T)
Inherits Option
Type Parameters
- T
The Type that the option's arguments are expected to be parsed as.
- Inheritance
Constructors
| Name | Description |
|---|---|
| Option<T>(String, String[]) |
Initializes a new instance of the Option class. |
Properties
| Name | Description |
|---|---|
| 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) |
| 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 |
Gets or sets a custom argument parser. |
| DefaultValueFactory |
Gets or sets 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 placeholder name shown in usage help for the option's value.
The value will be wrapped in angle brackets ( |
| Hidden |
Gets or sets a value indicating whether the symbol is hidden. (Inherited from Symbol) |
| Name |
Gets the name of the symbol. (Inherited from Symbol) |
| 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 |
Gets the Type that the option's parsed tokens will be converted to. |
Methods
| Name | Description |
|---|---|
| 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. |
| AcceptOnlyFromAmong(StringComparer, String[]) |
Configures the option to accept only the specified values using the specified comparer, and to suggest them as command line completions. |
| GetCompletions(CompletionContext) |
Gets completions for the symbol. (Inherited from Option) |
| GetDefaultValue() |
Gets the default value for the option. (Inherited from Option) |
| ToString() |
Returns a string that represents the current object. (Inherited from Symbol) |
Extension Methods
| Name | Description |
|---|---|
| AcceptExistingOnly<T>(Option<T>) |
Configures an option to accept only values corresponding to existing files or directories. |
Applies to
Feedback
Was this page helpful?
