CommandExtensions.InvokeAsync 方法

定義

多載

InvokeAsync(Command, String, IConsole)

剖析並叫用命令。

InvokeAsync(Command, String[], IConsole)

剖析並叫用命令。

InvokeAsync(Command, String, IConsole)

剖析並叫用命令。

public static System.Threading.Tasks.Task<int> InvokeAsync (this System.CommandLine.Command command, string commandLine, System.CommandLine.IConsole? console = default);
static member InvokeAsync : System.CommandLine.Command * string * System.CommandLine.IConsole -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function InvokeAsync (command As Command, commandLine As String, Optional console As IConsole = Nothing) As Task(Of Integer)

參數

command
Command

要叫用的命令。

commandLine
String

要剖析的命令行。

console
IConsole

叫用期間寫入輸出的控制台。

傳回

調用的結束代碼。

備註

命令行字串輸入會分割成令牌,就像已在命令行上傳遞一樣。

這個方法會儲存在工作中,它會傳回方法同步對應專案可以擲回的所有非使用狀況例外狀況。 如果例外狀況儲存在傳回的工作中,則會在等候工作時擲回該例外狀況。 使用狀況例外狀況,例如 ArgumentException,仍會同步擲回。 如需預存的例外狀況,請參閱 所 Invoke(Command, String, IConsole)擲回的例外狀況。

適用於

InvokeAsync(Command, String[], IConsole)

剖析並叫用命令。

public static System.Threading.Tasks.Task<int> InvokeAsync (this System.CommandLine.Command command, string[] args, System.CommandLine.IConsole? console = default);
static member InvokeAsync : System.CommandLine.Command * string[] * System.CommandLine.IConsole -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function InvokeAsync (command As Command, args As String(), Optional console As IConsole = Nothing) As Task(Of Integer)

參數

command
Command

要叫用的命令。

args
String[]

要剖析的自變數。

console
IConsole

叫用期間寫入輸出的控制台。

傳回

調用的結束代碼。

備註

這個方法會儲存在工作中,它會傳回方法同步對應專案可以擲回的所有非使用狀況例外狀況。 如果例外狀況儲存在傳回的工作中,則會在等候工作時擲回該例外狀況。 使用狀況例外狀況,例如 ArgumentException,仍會同步擲回。 如需預存的例外狀況,請參閱 所 Invoke(Command, String[], IConsole)擲回的例外狀況。

適用於