Edit

Share via


Argument<T> Constructors

Definition

Overloads

Argument<T>()

Initializes a new instance of the Argument class.

Argument<T>(Func<T>)

Initializes a new instance of the Argument class.

Argument<T>(ParseArgument<T>, Boolean)

Initializes a new instance of the Argument class.

Argument<T>(String, String)

Initializes a new instance of the Argument class.

Argument<T>(String, Func<T>, String)

Initializes a new instance of the Argument class.

Argument<T>(String, ParseArgument<T>, Boolean, String)

Initializes a new instance of the Argument class.

Argument<T>()

Initializes a new instance of the Argument class.

public:
 Argument();
public Argument ();
Public Sub New ()

Applies to

Argument<T>(Func<T>)

Initializes a new instance of the Argument class.

public:
 Argument(Func<T> ^ getDefaultValue);
public Argument (Func<T> getDefaultValue);
new System.CommandLine.Argument<'T> : Func<'T> -> System.CommandLine.Argument<'T>
Public Sub New (getDefaultValue As Func(Of T))

Parameters

getDefaultValue
Func<T>

The delegate to invoke to return the default value.

Exceptions

Thrown when getDefaultValue is null.

Applies to

Argument<T>(ParseArgument<T>, Boolean)

Initializes a new instance of the Argument class.

public Argument (System.CommandLine.Parsing.ParseArgument<T> parse, bool isDefault = false);
new System.CommandLine.Argument<'T> : System.CommandLine.Parsing.ParseArgument<'T> * bool -> System.CommandLine.Argument<'T>
Public Sub New (parse As ParseArgument(Of T), Optional isDefault As Boolean = false)

Parameters

parse
ParseArgument<T>

A custom argument parser.

isDefault
Boolean

true to use the parse result as default value.

Applies to

Argument<T>(String, String)

Initializes a new instance of the Argument class.

public Argument (string? name, string? description = default);
new System.CommandLine.Argument<'T> : string * string -> System.CommandLine.Argument<'T>
Public Sub New (name As String, Optional description As String = Nothing)

Parameters

name
String

The name of the argument.

description
String

The description of the argument, shown in help.

Applies to

Argument<T>(String, Func<T>, String)

Initializes a new instance of the Argument class.

public Argument (string name, Func<T> getDefaultValue, string? description = default);
new System.CommandLine.Argument<'T> : string * Func<'T> * string -> System.CommandLine.Argument<'T>
Public Sub New (name As String, getDefaultValue As Func(Of T), Optional description As String = Nothing)

Parameters

name
String

The name of the argument.

getDefaultValue
Func<T>

The delegate to invoke to return the default value.

description
String

The description of the argument, shown in help.

Exceptions

Thrown when getDefaultValue is null.

Applies to

Argument<T>(String, ParseArgument<T>, Boolean, String)

Initializes a new instance of the Argument class.

public Argument (string? name, System.CommandLine.Parsing.ParseArgument<T> parse, bool isDefault = false, string? description = default);
new System.CommandLine.Argument<'T> : string * System.CommandLine.Parsing.ParseArgument<'T> * bool * string -> System.CommandLine.Argument<'T>
Public Sub New (name As String, parse As ParseArgument(Of T), Optional isDefault As Boolean = false, Optional description As String = Nothing)

Parameters

name
String

The name of the argument.

parse
ParseArgument<T>

A custom argument parser.

isDefault
Boolean

true to use the parse result as default value.

description
String

The description of the argument, shown in help.

Exceptions

Thrown when parse is null.

Applies to