Skip to content
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

How to convert IObservable<IChangeSet<A,TKey>> to IObservable<IChangeSet<Tuple<A,A>,TKey>? #7

Open
jocontacter opened this issue Feb 22, 2021 · 6 comments

Comments

@jocontacter
Copy link

i need to pair up my original list like
Observable<A>.Buffer(2).Select(list => Tuple.Create(list[0], list[1]))
but there i have IChangeSet's which converts to Tuple<IChangeSet<A>,IChangeSet<A>> but not to IChangeSet<Tuple<A,A>> so i can't do .Bind(out pairs) on it

@glennawatson
Copy link

Don't use Select with DynamicData, use the Transform operator.

Also consider not using Tuple, try ValueTuple's and you can use the C# inbuilt way of using them (list[0], list[1]), ValueTuple have performance and memory advantages over Tuple's

@jocontacter
Copy link
Author

jocontacter commented Feb 23, 2021

Don't use Select with DynamicData, use the Transform operator.

Also consider not using Tuple, try ValueTuple's and you can use the C# inbuilt way of using them (list[0], list[1]), ValueTuple have performance and memory advantages over Tuple's

That is a problem - i can't do Transform() or Bind() on the result of Buffer() operator.

This is what i want to get:
I have elements list: [a1,a2,a3,a4,...] which i want to convert to pairs -> (a1,a2),(a3,a4),(a5,a6)...
How can i get a result like this?

Thanks for advice about ValueTuple.

@glennawatson
Copy link

You can do after you convert to a myObservable.ToObservableChangeSet()

@jocontacter
Copy link
Author

You can do after you convert to a myObservable.ToObservableChangeSet()

image
this is not what i need

@glennawatson
Copy link

Well that's useful information to know before you post since you only mention observable above

@jocontacter
Copy link
Author

Sorry for misleading.. In short, i'm stuck at this place

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

No branches or pull requests

2 participants