The title of this post should be 'How do I flatten IObservable<IEnumerable<T>> to IObservable<T>?'
But blogger says 'no'...
This seems like a simple & legitimate Rx question and if you're one of the initiated it's veryeasy simple.
It came up the other day because a back-end service we're talking to returned an array of stuff and we wanted to flatten it into a stream of single values we could observe.
So what do I replace CONVERT_SOMEHOW with?
voilĆ ...
But blogger says 'no'...
This seems like a simple & legitimate Rx question and if you're one of the initiated it's very
It came up the other day because a back-end service we're talking to returned an array of stuff and we wanted to flatten it into a stream of single values we could observe.
So what do I replace CONVERT_SOMEHOW with?
voilĆ ...
1: IObservable<int[]> numbers = Observable.Return(new[] {1, 2, 3, 4, 5});
2:
3: IObservable<int> number = numbers.SelectMany(n => n);
In a simple app:
produces the following output:
Comments
Post a Comment