private static void Example3() { MathService2 mathService = new MathService2(); mathService.MathPerformed += OnOutboundEvent; mathService.AddNumbers(3, 4); mathService.MultiplyNumbers(3, 4); }
private static void Example4() { MathService2 mathService = new MathService2(); new List <IMathPerformedService> { new LoggingService(), new NotificationService() }.ForEach(serv => mathService.MathPerformed += serv.OnMathPerformed); mathService.AddNumbers(3, 4); mathService.MultiplyNumbers(3, 4); }