c# - How does SequenceEqual work in Reactive Extensions -
i have hard time figure out how sequenceequal works in reactive extensions version 2.2.5
below code
var subject1 = new subject<int>(); var subject2 = new subject<int>(); iobservable<bool> sequenceequal = subject1.sequenceequal(subject2); subject1.onnext(5); subject1.onnext(3); subject2.onnext(1); subject2.onnext(4); //this notified if 2 sequences completed sequenceequal.subscribe(b => console.writeline("two sequences equal ? {0}", b)); subject1.oncompleted(); subject2.oncompleted();
i expected output "two sequences equal? false", result true contained different elements.
i'm wondering why result that? sequenceequal do?
with sequenceequals monitor point subscribe. subscribe before onnext calls , you'll false in subscription code or use replaysubjects.
Comments
Post a Comment