static void Main(string[] args) { SubjectClass subject = new SubjectClass(); ObserverClass observer = new ObserverClass(subject); subject.Value1 = 10; subject.Value1 = 100; observer.List(); Console.ReadLine(); }
public ObserverClass(SubjectClass subject) { subject.ValueChanged += TheValueChanged; }