Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Switchmap equivalent? #525

Closed
arnotes opened this issue Nov 4, 2022 · 3 comments
Closed

Switchmap equivalent? #525

arnotes opened this issue Nov 4, 2022 · 3 comments

Comments

@arnotes
Copy link

arnotes commented Nov 4, 2022

I was wondering if this library has a switchmap equivalent?
https://rxjs.dev/api/operators/switchMap

I tried ContinueWith but it doesnt seem to create cancellations

@arnotes arnotes closed this as completed Nov 6, 2022
@yujuiting
Copy link

I am also looking for SwitchMap.
Do you get any solution?

@arnotes
Copy link
Author

arnotes commented Nov 10, 2022

I am also looking for SwitchMap. Do you get any solution?

@yujuiting I ended up using this code I found on stackov
https://stackoverflow.com/questions/43139454/equivalent-of-rxjs-switchmap-in-reactivex-rx-net

obs1.Select(x => obs2).Switch()

@Thaina
Copy link

Thaina commented Mar 15, 2023

Maybe this would work?

object lastListen = null;
observable.SelectMany((id) => {
	lastListen = anotherObserverFromID(id);
	return anotherObserver.TakeWhile((_) => current == lastListen);
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants