Exemple #1
0
        public static void PrintEvens()
        {
            var ints  = new AllIntsStream();
            var evens = ints.Where(i => i % 2 == 0);

            evens.Subscribe(i => Console.WriteLine(i));
        }
Exemple #2
0
        public static void PrintSquaredEvens()
        {
            var ints         = new AllIntsStream();
            var evensSquared = ints.Where(i => i % 2 == 0)
                               .Select(i => i * i);

            evensSquared.Subscribe(i => Console.WriteLine(i));
        }
Exemple #3
0
        public static void ForComparison()
        {
            var xs = new AllIntsStream();
            var ys = xs.Where(x => cond(x))
                     .Select(x => f(x))
                     .Where(y => cond2(y));

            ys.Subscribe(y => Console.WriteLine(y));
        }
Exemple #4
0
        public static void PrintEvens()
        {
            var ints  = new AllIntsStream();
            var evens = ints.Where(i => i % 2 == 0);

            evens.DataAvailable += i => Console.WriteLine(i);

            ints.Start();
        }