Exemplo n.º 1
0
        static void DemoDisregardsDisposedSubscription()
        {
            var observable = new MyRangeObservableThatDisregardsSubscriptionStatus(5, 8);

            var observer = new MyObserver <int>();

            var subscription = observable.Subscribe(observer);

            subscription.Dispose();
            Console.WriteLine("The subscription has been disposed but we're still receiving values...");
        }
Exemplo n.º 2
0
        static void ViolatesContract()
        {
            var observable = new MyContractViolatingRangeObservable(5, 8);

            var observer = new MyObserver <int>();

            var subscription = observable.Subscribe(observer);

            Console.WriteLine("Press any key to dispose the subscription.");
            Console.ReadKey();
            subscription.Dispose();
        }