Edit

Share via


Option Constructors

Definition

Overloads

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.

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

Initializes a new instance of the Option class.

public Option (string name, string? description = default, Type? argumentType = default, Func<object?>? getDefaultValue = default, System.CommandLine.ArgumentArity arity = default);
new System.CommandLine.Option : string * string * Type * Func<obj> * System.CommandLine.ArgumentArity -> System.CommandLine.Option
Public Sub New (name As String, Optional description As String = Nothing, Optional argumentType As Type = Nothing, Optional getDefaultValue As Func(Of Object) = Nothing, Optional arity As ArgumentArity = Nothing)

Parameters

name
String

The name of the option, which can be used to specify it on the command line.

description
String

The description of the option shown in help.

argumentType
Type

The type that the option's argument(s) can be parsed to.

getDefaultValue
Func<Object>

A delegate used to get a default value for the option when it is not specified on the command line.

arity
ArgumentArity

The arity of the option.

Applies to

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

Initializes a new instance of the Option class.

public Option (string[] aliases, string? description = default, Type? argumentType = default, Func<object?>? getDefaultValue = default, System.CommandLine.ArgumentArity arity = default);
new System.CommandLine.Option : string[] * string * Type * Func<obj> * System.CommandLine.ArgumentArity -> System.CommandLine.Option
Public Sub New (aliases As String(), Optional description As String = Nothing, Optional argumentType As Type = Nothing, Optional getDefaultValue As Func(Of Object) = Nothing, Optional arity As ArgumentArity = Nothing)

Parameters

aliases
String[]

The set of strings that can be used on the command line to specify the option.

description
String

The description of the option shown in help.

argumentType
Type

The type that the option's argument(s) can be parsed to.

getDefaultValue
Func<Object>

A delegate used to get a default value for the option when it is not specified on the command line.

arity
ArgumentArity

The arity of the option.

Applies to