Example #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();
 }
Example #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();
        }