Command.SetAction Method

Definition

Overloads

SetAction(Action<ParseResult>)

Sets a synchronous action to be run when the command is invoked.

SetAction(Func<ParseResult,Int32>)

Sets a synchronous action to be run when the command is invoked.

SetAction(Func<ParseResult,CancellationToken,Task<Int32>>)

Sets an asynchronous action when the command is invoked.

SetAction(Func<ParseResult,CancellationToken,Task>)

Sets an asynchronous action to be run when the command is invoked.

SetAction(Func<ParseResult,Task<Int32>>)

Sets an asynchronous action to be run when the command is invoked.

SetAction(Func<ParseResult,Task>)

Sets an asynchronous action to be run when the command is invoked.

SetAction(Action<ParseResult>)

Source:
Command.cs

Sets a synchronous action to be run when the command is invoked.

public:
 void SetAction(Action<System::CommandLine::ParseResult ^> ^ action);
public void SetAction(Action<System.CommandLine.ParseResult> action);
member this.SetAction : Action<System.CommandLine.ParseResult> -> unit
Public Sub SetAction (action As Action(Of ParseResult))

Parameters

Applies to

SetAction(Func<ParseResult,Int32>)

Source:
Command.cs

Sets a synchronous action to be run when the command is invoked.

public:
 void SetAction(Func<System::CommandLine::ParseResult ^, int> ^ action);
public void SetAction(Func<System.CommandLine.ParseResult,int> action);
member this.SetAction : Func<System.CommandLine.ParseResult, int> -> unit
Public Sub SetAction (action As Func(Of ParseResult, Integer))

Parameters

Remarks

The value returned from the action delegate can be used to set the process exit code.

Applies to

SetAction(Func<ParseResult,CancellationToken,Task<Int32>>)

Source:
Command.cs

Sets an asynchronous action when the command is invoked.

public:
 void SetAction(Func<System::CommandLine::ParseResult ^, System::Threading::CancellationToken, System::Threading::Tasks::Task<int> ^> ^ action);
public void SetAction(Func<System.CommandLine.ParseResult,System.Threading.CancellationToken,System.Threading.Tasks.Task<int>> action);
member this.SetAction : Func<System.CommandLine.ParseResult, System.Threading.CancellationToken, System.Threading.Tasks.Task<int>> -> unit
Public Sub SetAction (action As Func(Of ParseResult, CancellationToken, Task(Of Integer)))

Parameters

Remarks

The value returned from the action delegate can be used to set the process exit code.

Applies to

SetAction(Func<ParseResult,CancellationToken,Task>)

Source:
Command.cs

Sets an asynchronous action to be run when the command is invoked.

public:
 void SetAction(Func<System::CommandLine::ParseResult ^, System::Threading::CancellationToken, System::Threading::Tasks::Task ^> ^ action);
public void SetAction(Func<System.CommandLine.ParseResult,System.Threading.CancellationToken,System.Threading.Tasks.Task> action);
member this.SetAction : Func<System.CommandLine.ParseResult, System.Threading.CancellationToken, System.Threading.Tasks.Task> -> unit
Public Sub SetAction (action As Func(Of ParseResult, CancellationToken, Task))

Parameters

Applies to

SetAction(Func<ParseResult,Task<Int32>>)

Source:
Command.cs

Sets an asynchronous action to be run when the command is invoked.

public:
 void SetAction(Func<System::CommandLine::ParseResult ^, System::Threading::Tasks::Task<int> ^> ^ action);
public void SetAction(Func<System.CommandLine.ParseResult,System.Threading.Tasks.Task<int>> action);
member this.SetAction : Func<System.CommandLine.ParseResult, System.Threading.Tasks.Task<int>> -> unit
Public Sub SetAction (action As Func(Of ParseResult, Task(Of Integer)))

Parameters

Remarks

When possible, prefer using the SetAction(Func<ParseResult,CancellationToken,Task<Int32>>) overload and passing the CancellationToken parameter to the async method(s) called by the action.

Applies to

SetAction(Func<ParseResult,Task>)

Source:
Command.cs

Sets an asynchronous action to be run when the command is invoked.

public:
 void SetAction(Func<System::CommandLine::ParseResult ^, System::Threading::Tasks::Task ^> ^ action);
public void SetAction(Func<System.CommandLine.ParseResult,System.Threading.Tasks.Task> action);
member this.SetAction : Func<System.CommandLine.ParseResult, System.Threading.Tasks.Task> -> unit
Public Sub SetAction (action As Func(Of ParseResult, Task))

Parameters

Remarks

When possible, prefer using the SetAction(Func<ParseResult,CancellationToken,Task>) overload and passing the CancellationToken parameter to the async method(s) called by the action.

Applies to