Beispiel #1
0
        // Команды могут делегировать выполнение любым методам получателя.
        public void Execute()
        {
            Console.WriteLine("ComplexCommand. Execute. Begin");

            _receiver.DoSomething(_a);
            _receiver.DoSomethingElse(_b);

            Console.WriteLine("ComplexCommand. Execute. End");
            Console.WriteLine();
        }
 // However, some commands can delegate more complex operations to other
 // objects, called "receivers."
 public void Execute()
 {
     Console.WriteLine("ComplexCommand: Complex stuff should be done by a receiver object.");
     _receiver.DoSomething(_a);
     _receiver.DoSomethingElse(_b);
 }