static void Main(string[] args) { var viedo = new Video() { Title = "Video 1" }; var videoEncoder = new VideoEncoder(); //Publisher var mailService = new MailService(); //Subscriber var messageService = new MessageService(); //Subscriber videoEncoder.VideoEncoded += mailService.onVideoEncoded; videoEncoder.VideoEncoded += messageService.OnVideoEncoded; videoEncoder.Encode(viedo); }
static void Main(string[] args) { var video = new Video() { Title = "Video" }; var videoEncoder = new VideoEncoder(); // publisher var mailService = new MailService(); // subscriber var messageService = new MessageService(); // subscriber var notService = new NotificationService(); // lets do the subscription //publisher // event videoEncoder.VideoEncoded += mailService.OnVideoEncoded; videoEncoder.VideoEncoded += messageService.OnVideoEncoded; videoEncoder.VideoEncoded += notService.OnVideoEncoded; videoEncoder.Encode(video); }