public void UseMyObservable() { var myObservable = new MyObservable(); var firstUnsubscribe = myObservable.Subscribe(new Observer("First")); var secondUnsubscribe = myObservable //.ObserveOn(NewThreadScheduler.Default) .Subscribe(new Observer("Second")); myObservable.Subscribe(message => Log.WriteLine("[Third] {0}", message)); myObservable.Send("Hello"); myObservable.Send(".. and again"); //myObservable.Error("Error message"); firstUnsubscribe.Dispose(); secondUnsubscribe.Dispose(); }
public Unsubscriber(IObserver <string> observer, MyObservable myObservable) { this.observer = observer; this.myObservable = myObservable; }