Observer pattern implementation in C#
Here's a problem:

var o = new Observable&lt;Unit&gt;();
var a = o.Subscribe(_ =&gt; Console.WriteLine("A"));
var b = o.Subscribe(_ =&gt; Console.WriteLine("B"));
a.Dispose();
o.Notify(Unit.Default);


This prints


A


Disposing of a removed the wrong observer.



I'd recommend reading Why shouldn't I implement IObservable&lt;T&gt;?


  The reason you shouldn't implement IObservable&lt;T&gt; is the same reason
  you don't usually implement IEnumerable&lt;T&gt;, is that somebody has most
  likely already built the thing you want.