示例#1
0
 public void subscribe(YouTubeChannel toSubscribe)
 {
     try
     {
         this.subscribedTo.Add(toSubscribe.Name, toSubscribe);
         toSubscribe.registerObserver(this);
     }
     catch (ArgumentException)
     {
         Console.WriteLine("You are already subscribed to this channel!");
     }
 }
示例#2
0
 public void unsubscribe(YouTubeChannel toUnsubscribe)
 {
     this.subscribedTo.Remove(toUnsubscribe.Name);
     toUnsubscribe.removeObserver(this);
 }