コード例 #1
0
        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();
        }
コード例 #2
0
 public Unsubscriber(IObserver <string> observer, MyObservable myObservable)
 {
     this.observer     = observer;
     this.myObservable = myObservable;
 }