static void Main(string[] args) { ICommandReceiver recevier = new CommandReceiver(); Invoker invoker = new Invoker(); invoker.Add(new InsertCommand(recevier)); invoker.Add(new InsertCommand(recevier)); invoker.Add(new UpdateCommand(recevier)); invoker.Add(new DeleteCommand(recevier)); invoker.ExecuteAsync(); }
/// <summary> /// 通够构造方法,明确我们要使用任务接收者 /// </summary> /// <param name="receiver"></param> public Method1Command(CommandReceiver receiver) { this.receiver = receiver; }