Posts

Showing posts with the label C#

Writing Your First Rx Statement

Image
Introduction In my first blog post on Reactive Extensions (Rx),  Introduction to Reactive Extensions , I mentioned that there are several ways in which you can create an IObservable<T>. The most fundamental way to create an IObservale<T> is be using the Observable.Create<TSource>() method.  At first glance this method is a bit confusing but once you know how to implement it, it becomes very powerful. You First Rx Statement  In this tutorial I will build a Windows console application that will make an asynchronous web call to the Twitter API using the WebClient.DownloadStringAsync() and Rx.  I begin by creating a new console application called SampleRxApp. Next, I add the appropriate Rx reference.  For this, I use Nuget to add a reference to Rx-Main. Once I have added necessary Rx library, I add the following using statement to the top of my Program.cs file.  using System; using System.Net; using...

Introduction to Reactive Extensions

Working in the field of technology means constantly learning new technologies and using them to build cool new software.  I think my desire to learn is what drove me to this industry.   My most recent endeavor was learning the Reactive Extensions (Rx) for the .NET framework.  I had no reason to believe that picking up Rx would be any different from any other technology.  Boy was I wrong!  In my 10 years of learning new technologies, the difficultly of learning Rx rated right up there with making the switch from procedural to object oriented programming.  It is a paradigm shift that requires you to completely rethink the way you develop.  Developing with Rx will probably come more naturally for those of you well versed in asynchronous programming, but I did not have much exposure to async programming prior to this undertaking (which is probably why I found it so difficult to pick up).   Another reason why I found it difficult to learn Rx...