static void Main(string[] args) { SteveObserver steveObserver = new SteveObserver(); JohnObserver johnObserver = new JohnObserver(); NotificationService service = new NotificationService(); service.AddSubscriber(johnObserver); service.AddSubscriber(steveObserver); service.NotifySubscriber(); service.RemoveSubscriber(johnObserver); Console.ReadLine(); }
static void Main(string[] args) { var steve = new SteveObserver(); var john = new JohnObserver(); var noticificationService = new NotificationService(); noticificationService.AddSubscriber(steve); noticificationService.AddSubscriber(john); noticificationService.NotifySubscriber(); noticificationService.RemoveSubsriber(steve); }
private static void Main(string[] args) { INotificationService notificationService = new NotificationService(); INotificationObserver john = new JohnObserver(); INotificationObserver steve = new SteveObserver(); notificationService.AddSubscriber(john); notificationService.AddSubscriber(steve); notificationService.NotifySubscriber(); Console.WriteLine(); notificationService.RemoveSubscriber(john); notificationService.NotifySubscriber(); }