public static async Task Run() { ICommandDispatcher dispatcher = Configure(); OutputToConsoleCommand command = new OutputToConsoleCommand { Message = "Hello" }; CountResult result = await dispatcher.DispatchAsync(command); Console.WriteLine($"{result.Count} actors called"); await dispatcher.DispatchAsync(command); Console.WriteLine("\nPress a key to continue..."); }
public static async Task Run() { Stack <object> stack = new Stack <object>(); ICommandDispatcher dispatcher = Configure(stack); await dispatcher.DispatchAsync(new OutputToConsoleCommand { Message = "Hello" }); await dispatcher.DispatchAsync(new OutputToConsoleCommand { Message = "World" }); while (stack.Any()) { OutputToConsoleCommand command = (OutputToConsoleCommand)stack.Pop(); Console.WriteLine(command.Message); } Console.WriteLine("\nPress a key to continue..."); }