Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Annotated program -- Keyboard shortcut: 't'    patterns/observer/template/observer-only.cs - A templates of the Observer class.Lecture 6 - slide 17 : 20
Program 2

using System.Collections;
namespace Templates.Observer {

 public class Observer {                      

   private Subject mySubject;                 
                                              
   public Observer (Subject s){               
     mySubject = s;
   }   

   public void Update(){                      
      // ...                                  

      SubjectState state = mySubject.GetState();   
                                                   
      //   if (the state is interesting){
      //      react on state change
      //   }
   }
 }
}