using System; namespace cylvester { interface IChangeObserver where T : IComparable { T Value { set; } event Action ValueChanged; } public class ChangeObserver : IChangeObserver where T : IComparable { private T value_; public ChangeObserver(T initial) { Value = initial; } public T Value { set { if (value.CompareTo(value_) == 0) return; value_ = value; ValueChanged.Invoke(); } } public event Action ValueChanged = () => { }; } }