Chain of observations

Is there a shortened version of this. I want to call one sequence, and then when it is complete, call another.

var seq1 = Observable.Range(1, 20);
var seq2 = Observable.Range(21, 20);

seq1.Subscribe(
    i  => Console.WriteLine(i), 
    () => seq2.Subscribe(i => Console.WriteLine(i)));
+3
source share
1 answer

I don’t quite understand what you are trying to do (and I don’t have any documents to transmit), but Observables.Concat, what are you after?

var seq1 = Observable.Range(1, 20);
var seq2 = Observable.Range(21, 20);
var both = seq1.Concat(seq2);
both.Subscribe(i => Console.WriteLine(i));

(I just check that this works :)

+3
source

Source: https://habr.com/ru/post/1735048/


All Articles