static void Main(string[] args) { Receiver receiver = new Receiver(); ICommand cmd = new PrintCommand(receiver); Invoker invoker = new Invoker(); invoker.StoreCommand(cmd); invoker.Invoke(); }
static void Main(string[] args) { Receiver receiver = new Receiver(); Command command = new ConcreteCommand(receiver); Invoker invoker = new Invoker(); invoker.StoreCommand(command); invoker.ExecuteCommand(); Console.ReadLine(); }
static void Main(string[] args) { Command c = new ConcreteCommand(); Receiver r = new Receiver(); c.R = r; Invoker i = new Invoker(); i.StoreCommand(c); i.ExecuteCommand(); }