Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          patterns/observer/template-with-events/subject-only.cs - Template of the Subject class.Lecture 6 - slide 19 : 20
Program 1

using System.Collections;
namespace Templates.Observer {

 public delegate void Notification(SubjectState ss);

 public class Subject {
   // Subject instance variable

   private event Notification observerNotifier;

   public void AddNotifier(Notification n){
     observerNotifier += n;
   }

   public void RemoveNotifier(Notification n){
     observerNotifier -= n;
   }

   public void Notify(){
     observerNotifier(new SubjectState());
   }
 }

 public class SubjectState {
   // Selected state of the subject
 }
}