IObservable<Either<T, Exception>> conversion

Topics: Interactive (Ix), Reactive (Rx)
Apr 17, 2013 at 12:15 PM
so i have a subscription that returns IObservable<Either<T, Exception>> from an external source, and i would like to convert that into IObservable<Either<T, MyAppException>>, where MyAppException takes Exception as a parameter in ctor.

can you please advise a way of doing this? thanks
Coordinator
Apr 17, 2013 at 1:10 PM
Hi,

You can use this overload of Select. It allows you to project both sides of Either.

For example:
IObservable<Either<T, Exception>> xs = GetObservableFromExternalSource();

IObservable<Either<T, MyAppException>> ys = xs.Select(t => t, ex => new MyAppException(ex));
See also:
https://rxx.codeplex.com/discussions/401272

- Dave
Apr 17, 2013 at 1:27 PM
Good stuff, worked, thanks