Exemplo n.º 1
0
        public override void Register(Participant participant)
        {
            if (!participants.ContainsKey(participant.Name))
            {
                participants[participant.Name] = participant;
            }

            participant.Chatroom = this;
        }
Exemplo n.º 2
0
        static void Main()
        {
            var chatroom = new Chatroom();

            var dave = new Participant { Name = "dave" };
            var lisa = new Participant { Name = "lisa" };
            var mike = new Participant { Name = "mike" };

            chatroom.Register(dave);
            chatroom.Register(lisa);
            chatroom.Register(mike);

            dave.Send("lisa", "hello lisa");
            lisa.Send("dave", "hi");

            mike.Send("dave", "can we meet?");

            Console.ReadLine();
        }
Exemplo n.º 3
0
 public abstract void Register(Participant participant);