Although I use Observable and Rx in my code from time to time I still have this question in terms of "push model" and its use.
For example, let's say I have this simple code:
private readonly static List<string> numbers = new List<string>
{
"1",
"2",
"3",
"4",
"5"
};
static void Main(string[] args)
{
PrintCollection();
Console.ReadLine();
numbers.Add("6");
Console.ReadLine();
}
private static void PrintCollection()
{
IObservable<string> observable = numbers.ToObservable();
observable.Subscribe<string>(x => { Console.WriteLine(x); });
}
When the program runs only 1-5 will be printed but not 6 unless I use something like an ObservableCollection and hook up the "CollectionChanged" event. However, this makes me wonder what the "push model" really is. I always thought the "push model" meant once the data (colleciton) has subscribed to an event all newly added data to that collection would be subscribed to the same event as well.
Also, most of the examples I've seen using Observable seem to be WPF, view-model-driven implmenentation and I wonder if anyone has used it for any back-end processing and what would be a typical example of that?