![]() So if you have to remember something, it's that the Enumerable collections are pulling data from the source and the Observable collections are pushing data from the source. ![]() Just like the Enumerable collections where you can perform various LINQ operations, the same are implemented for the Observable collections. Basically the RX Framework consists of two interfaces - IObservable and IObserver. Normally, any Enumerable collection can be turned into Observable collection and vice versa. The interesting point here is that the RX developers consider the IObservable as a mathematical dual to the IEnumerable interface. On one side – we have the Iterator pattern ( IEnumerable\IEnumerator) and on the other side we have the Observer pattern ( IObservable\IObserver). You can then subscribe to this observable using an instance of an object implementing the IObserver interface. All RX style collections are unified by the IObservable interface. Yes, the centerpiece of the RX Framework is the Observer pattern. If we again refer to the design patterns, we will see that we have an implementation of the Observer pattern. The mouse cursor’s location value is changing over a period of time, and an event notifies you about that - or in other words, the source is pushing values to you. It represents another very common situation in the programming, namely, the usage of events. What does “push values to you” mean? Take a look again at the next code snippet. And here is another key moment to understand. Now, if we take a look at the RX style collection, they are push collections. What we have here is an implementation of the Iterator pattern ( IEnumerable\IEnumerator). If you are using a loop, you receive the data from a collection over a period of time, or in other words, you are pulling the data, saying “move next, move next”, pulling the elements out. If you take a look at these collections, they are pulling collection. ![]() Arrays, lists, they all implement the IEnumerable interface. NET Framework they are all unified by IEnumerable. How many times have you done this in your application? Consider for a moment the collections in. The next step was to watch several introduction videos on Channel 9 they helped me to understand better the meaning (the idea) of the framework. Ok, this is the official description, but it sounds pretty academic and initially it didn’t give me any understanding about the RX Framework. NET Framework) is one and the same designation for a library for composing asynchronous and event-based programs using observable collections. So the first step was to answer several important questions such as: “what is Linq to Events?”, “what is RX Framework?”, and “what is Reactive Programming?” And generally what lies behind these sound terms? Linq to events or RX Framework (also known as Reactive Extensions for. NET Framework and also available for Silverlight applications is the RX Framework. The arising interest around the RX Framework made me roll up my sleeves and start playing around this. One of the coolest features which is part of. This is part 1 of the series “Reactive Extensions in Silverlight”. This article is compatible with the latest version of Silverlight.
0 Comments
Leave a Reply. |