Concat Bug
-
giovedì 17 dicembre 2009 02:16
Concat doesn't seem to be working for me. I'm running the 3.5 SP1 build (1.0.2067.0).
Am I doing something silly?
var five = Observable.Interval(TimeSpan.FromSeconds(5)); var one = Observable.Interval(TimeSpan.FromSeconds(1)); five.Concat(one).Subscribe(l => Console.WriteLine(DateTime.Now + " : " +l));
Output:17/12/2009 10:21:00 AM : 0
17/12/2009 10:21:05 AM : 1
17/12/2009 10:21:10 AM : 2
We are missing the 1 second "ticks".
Thanks,
James
Tutte le risposte
-
giovedì 17 dicembre 2009 04:15
Concat waits for the left source to complete before subscribing to the right source. Since Observable.Interval never completes then five.Concat(one) == five.Perhaps, what you are looking for is Merge which interleaves the messages from the two sources.- Contrassegnato come risposta James Miles giovedì 17 dicembre 2009 04:20
-
giovedì 17 dicembre 2009 04:20Ahh - Thanks Wes!
-
giovedì 17 dicembre 2009 10:04Also, check out http://rxwiki.wikidot.com/101samples and see if the concat samples help/make sense.

