I want to create an Observable that keeps pushing a list of values every t
seconds.
For example, given the {1, 2, 3, 4} subscribers should get this:
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2...
class Program
{
static void Main()
{
var observable = Observable
.Interval(TimeSpan.FromSeconds(3))
.Zip(Observable.Range(1, 4)
.Repeat(), (_, count) => count);
observable.Subscribe(Console.WriteLine);
Console.WriteLine("Finished!");
}
}
I have worked on this example and it seems to work, but with a very nasty problem: the Main method never ends its execution! Why? :(
And even worse, after some minutes, this console application throws an
OutOfMemoryException
!