コード例 #1
0
        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
ファイル: Program.cs プロジェクト: kaurbanski/DesignPatterns
        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();
        }