static void Main(string[] args)
 {
     CarFactory factory = new CarFactory();
     Consumer fernando = new Consumer("Fernando");
     factory.CarCreated += fernando.ACarIsHere;
     factory.CreateACar("Mercedes");
     Consumer seb = new Consumer("Seb");
     factory.CarCreated += seb.ACarIsHere;
     try
     {
         factory.CreateACar("McLaren");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     factory.CarCreated -= fernando.ACarIsHere;
     factory.CreateACar("Ferrari");
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            CarFactory factory  = new CarFactory();
            Consumer   fernando = new Consumer("Fernando");

            factory.CarCreated += fernando.ACarIsHere;
            factory.CreateACar("Mercedes");
            Consumer seb = new Consumer("Seb");

            factory.CarCreated += seb.ACarIsHere;
            try
            {
                factory.CreateACar("McLaren");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            factory.CarCreated -= fernando.ACarIsHere;
            factory.CreateACar("Ferrari");
        }