Beispiel #1
0
        static void Main(string[] args)
        {
            var service       = new Service();
            var coffeeService = new CoffeeService();

            var items = service.Get();


            var coffeeItems = coffeeService.Get();

            //foreach (var item in items)
            //{
            //    Console.WriteLine(item);
            //}

            IObservable <int> observableWater  = items.ToObservable();
            IObservable <int> observableCoffee = coffeeItems.ToObservable();

            var observable = observableWater
                             .Concat(observableCoffee);

            var stream2 = observable
                          .Where(item => item > 70);


            stream2.Subscribe(item => Console.WriteLine($"sub1 {item}"));

            observable
            .Where(item => item < 10)
            .Subscribe(item => Console.WriteLine($"sub2 {item}"));



            Console.WriteLine("Press any key to exit.");

            Console.ReadKey();
        }