Пример #1
0
 static void Main()
 {
     CarPublisher car = new CarPublisher();
     car.StartEngine();
     car.RaiseMyEvent += HandleMyEvent;
     car.RaiseEvent += HandelEvent;
     Console.WriteLine();
     car.StopEngine();
     Console.WriteLine();
     car.StartEngine();
     Console.WriteLine();
     car.TurnLeft();
     car.RaiseMyEvent += HandelEvent;
     Console.WriteLine();
     car.StopEngine();
     Console.WriteLine();
     car.RaiseEvent += (sender, e) => Console.WriteLine("Lambda");
     car.TurnRight();
 }
Пример #2
0
        static void Main()
        {
            CarPublisher car = new CarPublisher();

            car.StartEngine();
            car.RaiseMyEvent += HandleMyEvent;
            car.RaiseEvent   += HandelEvent;
            Console.WriteLine();
            car.StopEngine();
            Console.WriteLine();
            car.StartEngine();
            Console.WriteLine();
            car.TurnLeft();
            car.RaiseMyEvent += HandelEvent;
            Console.WriteLine();
            car.StopEngine();
            Console.WriteLine();
            car.RaiseEvent += (sender, e) => Console.WriteLine("Lambda");
            car.TurnRight();
        }