Sunday, March 24, 2013

The Reactive Extensions - (Rx)


Rx = Observables + LINQ + Schedulers.


RX mainly use for asynchronous programming.
Simple sample I share here to learn basic about RX.

First download RX package from Nuget Package Gallery.
http://nuget.org/packages/Rx-Main/

Example :

using System;
using System.Reactive.Linq;

namespace SimpleRX
{
    class Program
    {
        static void Main(string[] args)
        {
            var observableSample = Observable.Interval(TimeSpan.FromSeconds(1)).Timestamp();

            using (observableSample.Subscribe(
                x => Console.WriteLine("{0}: {1}", x.Value, x.Timestamp)))
            {
                Console.WriteLine(" \n Press any key to unsubscribe me ..... \n");
                Console.ReadKey();
            }
        }
    }
}

1 comment:

  1. For any technical support call Toll Free: 1-844-332-7016 : http://www.gcomtechsupport.com/

    ReplyDelete

Leave your comment here