Argument<T> 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Argument<T>() |
初始化 Argument 类的新实例。 |
Argument<T>(Func<T>) |
初始化 Argument 类的新实例。 |
Argument<T>(ParseArgument<T>, Boolean) |
初始化 Argument 类的新实例。 |
Argument<T>(String, String) |
初始化 Argument 类的新实例。 |
Argument<T>(String, Func<T>, String) |
初始化 Argument 类的新实例。 |
Argument<T>(String, ParseArgument<T>, Boolean, String) |
初始化 Argument 类的新实例。 |
Argument<T>()
初始化 Argument 类的新实例。
public:
Argument();
public Argument ();
Public Sub New ()
适用于
Argument<T>(Func<T>)
初始化 Argument 类的新实例。
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))
参数
- getDefaultValue
- Func<T>
要调用以返回默认值的委托。
例外
当 getDefaultValue
为 null 时引发。
适用于
Argument<T>(ParseArgument<T>, Boolean)
初始化 Argument 类的新实例。
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)
参数
- parse
- ParseArgument<T>
自定义参数分析程序。
- isDefault
- Boolean
true
将 parse
结果用作默认值。
适用于
Argument<T>(String, String)
初始化 Argument 类的新实例。
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)
参数
- name
- String
参数的名称。
- description
- String
参数的说明,显示在帮助中。
适用于
Argument<T>(String, Func<T>, String)
初始化 Argument 类的新实例。
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)
参数
- name
- String
参数的名称。
- getDefaultValue
- Func<T>
要调用以返回默认值的委托。
- description
- String
参数的说明,显示在帮助中。
例外
当 getDefaultValue
为 null 时引发。
适用于
Argument<T>(String, ParseArgument<T>, Boolean, String)
初始化 Argument 类的新实例。
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)
参数
- name
- String
参数的名称。
- parse
- ParseArgument<T>
自定义参数分析程序。
- isDefault
- Boolean
true
将 parse
结果用作默认值。
- description
- String
参数的说明,显示在帮助中。
例外
当 parse
为 null 时引发。