I am playing with Rx in .Net3.5SP1 and trying the 101 Rx Samples. I am trying the first sample (Start - Run Code Asynchronously) but it doesn't seem to actually run asynchronously. For example,
Console.WriteLine("[Creating]");
var o = Observable.Start(() =>
{
Console.WriteLine("Calculating...");
Thread.Sleep(3000);
Console.WriteLine("Done.");
});
Console.WriteLine("[Created]");
Console.WriteLine("[Starting]");
o.First(); // subscribe and wait for completion of background operation
Console.WriteLine("[Started]");
Outputs
[Creating]
[Created]
[Starting]
Calculating...
<...3 Second Wait...>
Done.
[Started]
Is there an explanation for this? Am I doing something wrong? Is this expected behaviour?
UPDATE
I would have thought it would have said
[Creating]
[Created]
[Starting]
Calculating...
[Started]
<...3 Second Wait...>
Done.
But the main thread is blocked while the supposedly Asynch call happens.