static void Main(string[] args)
        {
            var observable = (new int[] { 1, 2, 3 }).ToObservable();
            var myObserver = new MyObserver();

            observable.Subscribe(myObserver);
        }
示例#2
0
        static void Main(string[] args)
        {
            var myObservable   = (new int[] { 1, 2, 3 }).ToObservable();
            var myObserver     = new MyObserver();
            var mySubscription = myObservable.Subscribe(myObserver);

            mySubscription.Dispose();


            //Another way to create an Observable is to give the implementaions that needs to be run when we call the .Subscribe() on this Observable
            Func <IObserver <int>, IDisposable> subscribe = (obs) => { Console.WriteLine(""); return(Disposable.Empty); };
            IObservable <int> myOtherObservable           = Observable.Create <int>(subscribe);
        }