Why shouldn't I implement IObservable<T>?
c#, system.reactive
Solution
The reason you shouldn't implement `IObservable<T>` is the same reason you don't usually implement `IEnumerable<T>`, is that somebody has most likely already built the thing you want. In this case, you've basically reimplemented `Subject<T>` for the most part.
Edit: As to the Lazy question in the comments, I'd implement that this way:
var lazyObservable = Observable.Create<TFoo>(subj => { /*TODO: Implement Me to load from reflection*/ })
.Multicast(new Subject<TFoo>()) // This means it'll only calc once
.RefCount(); // This means it won't get created until someone Subscribes
Problem
Reading msdn about the Reactive Extensions and such, I've found a recommendation saying I shouldn't implement IObservable, rather use Observable.Create... By the time I've read this, my project already had an `ObservableImplementation<T>` class, which I'd used as an IObservable source, everywhere I wanted to transform events into Observables. I've read the `AbstractObservable<T>` implementation in System.Reactive, and I haven't found any major difference between their code and mine. So what's wrong with implementing IObservable? I can add my own properties to it, and so on... for fullness sake, here is my implementation, please tell me if I did anything wrong! ``` public sealed class ObservableImplementation<T> : IObservable<T> { class Subscription : IDisposable { private readonly Action _onDispose; public Subscription(Action onDispose) { _onDispose = onDispose; } public void Dispose() { _onDispose(); } } public void Raise(T value) { _observers.ForEach(o => o.OnNext(value)); } public void Completion() { _observers.ForEach(o => o.OnCompleted()); _observers.Clear(); } private readonly List<IObserver<T>> _observers = new List<IObserver<T>>(); public IDisposable Subscribe(IObserver<T> observer) { var subscription = new Subscription(() => _observers.Remove(observer)); _observers.Add(observer); return subscription; } public bool AnyObserverPresent { get { return _observers.Any(); } } } ```