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

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

  •  01-07-2022
  •  | 
  •  

Pregunta

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.

¿Fue útil?

Solución

I think this will work:

var referenceBack2 = source.Zip(source.Skip(1), (a, b) => a)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top