-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WithLatestFrom #90
Comments
This is an implementation, if you want something quick:
|
I have something like this that's working (I think 😝). Would love some feedback on it: public static IObservable<TResult> WithLatestFrom<TResult, TFirst, TSecond>(
this IObservable<TFirst> first,
IObservable<TSecond> second,
Func<TFirst, TSecond, TResult> resultSelector)
{
return Observable.Create<TResult>(observer =>
{
var published = first.Publish();
var connection = published.Connect();
var subscription = second
.Select(a => published
.Select(b => resultSelector(b, a)))
.Switch()
.Subscribe(observer);
return new CompositeDisposable(connection, subscription);
});
} |
It passes my test, but it's got slightly more code in! ;) Looks fine though - nice approach. If you used the variant of
|
👍 |
This operator has been added for the next release of Rx.NET. |
Thanks, @bartdesmet! 👍 |
I'd ❤️ to see the
withLatestFrom
method from RxJava and RxJS be ported over to .NET as well.For reference: http://rxmarbles.com/#withLatestFrom
The text was updated successfully, but these errors were encountered: