I am reading IntroToRx and I'm having a bit of trouble with the sample code. Here is the sum total of my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace LearningReactiveExtensions
{
public class Program
{
static void Main(string[] args)
{
var observable = Observable.Interval(TimeSpan.FromSeconds(5));
observable.Subscribe(
Console.WriteLine,
() => Console.WriteLine("Completed")
);
Console.WriteLine("Done");
Console.ReadKey();
}
}
}
If I understand the book correctly, this should write a sequence of numbers to the console, once every five seconds forever since I never Dispose()
of the sequence.
However, when I run the code, all I get is the "Done" at the end. No numbers, no "completed", nothing but "Done".
What am I doing wrong here?