Referencing previous items - Is there any Observable extension for this in Rx or Rxx?

StackOverflow https://stackoverflow.com/questions/19624108

  •  01-07-2022
  •  | 
  •  

문제

I have an IObservable, I am looking for a way to do something like this

var referenceBack2 = source.Ref(2);

say I have this sequence coming in source

A-B-C-D-E-F-G-H

The referenceBack2 will not do OnNext() on A until B comes through source, will not render B until C comes in, and at the end it will render G. H will wait forever because A is hot observable and no element is coming after H.

도움이 되었습니까?

해결책

I think this will work:

var referenceBack2 = source.Zip(source.Skip(1), (a, b) => a)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top