Reactive extensions for .Net are an asynchronous event-based programming libraries. They use observable collections for doing so.
I have used Thread Pools, spawning my own threads, Aynsc using Begin and End Invoke pattern and also use Jeff Richter’s APM libraries to do Async programming. Guys who are used to using background worker class have been doing Aynsc programming for a long time already. Well , Why RX then. I don’t know yet. I have heard good things about it and I thought I will play with it a bit. So here it is
- Download RX from http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx
- Start a new C# console application and add reference to System.Reactive. Please be aware that that you can use RX from Dot Net framework 3.5 onwards so your target framework should be 3.5 or higher . I have downloaded the 3.5 version of RX and using VS 2008 + dot net framework 3.5 so this is what I have in the project properties
3. Add reference to these libraries
- Paste this code
using System; using System.Linq; using System.Threading; namespace HelloRx { internal class Program { private static void Main(string[] args) { var o = Observable.Start(() => { Console.WriteLine("Hello RX."); Thread.Sleep(3000); Console.WriteLine("Done."); }); o.First(); // subscribe and wait for completion of background operation } } }
- 5. Hit F5 and you have written your first code using Reactive extensions
thanks
Multiple reasons for light also allow it to be easy
to adjust the lighting level when working.