I play with Rx in .Net3.5SP1 and try 101 Rx Samples . I am trying to execute the first example (Start - Run Code Asynchronously), but it does not seem to work 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 any explanation for this? Am I doing something wrong? Is this expected behavior?
UPDATE
I would think I would say
[Creating]
[Created]
[Starting]
Calculating...
[Started]
<...3 Second Wait...>
Done.
But the main thread is blocked while the alleged Asynch call is taking place.
source
share