static void Main(string[] args)
        {
            YoutubeChannel muriloxkChannel = new YoutubeChannel();

            ISubscriber joey = new User();
            ISubscriber alex = new User();
            ISubscriber gai  = new Moderator();

            muriloxkChannel.Subscribe(joey);
            muriloxkChannel.Subscribe(alex);
            muriloxkChannel.Subscribe(gai);

            muriloxkChannel.NotifySubscribers();
            Console.ReadKey();
        }
示例#2
0
        public static void Main(string[] args)
        {
            IObserver user1 = new User("Kamil");
            IObserver user2 = new User("Jan");

            YoutubeChannel channel = new YoutubeChannel();

            channel.Register(user1);
            channel.Register(user2);

            channel.PublishNewVide();
            channel.PublishNewVide();
            channel.Unregister(user1);
            channel.PublishNewVide();
            Console.ReadLine();
        }