Super-simple example of C# observer/observable with delegates

The observer pattern is usually implemented with events. Here’s an example: using System; class Observable { public event EventHandler SomethingHappened; public void DoSomething() => SomethingHappened?.Invoke(this, EventArgs.Empty); } class Observer { public void HandleEvent(object sender, EventArgs args) { Console.WriteLine(“Something happened to ” + sender); } } class Test { static void Main() { Observable observable = … Read more