Home > Net >  How to write a SelectManyLatest operator in Rx.NET and UniRx [closed]
How to write a SelectManyLatest operator in Rx.NET and UniRx [closed]

Time:09-25

SelectManyLatest is necessary operator. But All Internet don't answer how you can write it. So how?

SelectManyLatest is a FlatMapLatest in other Rx Frameworks. This operator like SelectMany but it complete previous subscription if new emit happens.

CodePudding user response:

Add as an Extension

public static IObservable<V> SelectManyLatest<T, V>(this IObservable<T> source, Func<T, IObservable<V>> selector)
{
    return source
        .Select(selector)
        .Switch();
}
  • Related