How to convert from IObservable <a> to IObservable <b>
Do I have a method that returns an interface IObservable<A>(in silverlight) and wants to convert it to another IObservable<B>?
So what do I need instead of "CONVERT_SOME_HOW"
public IObservable<Bar> Get(IEnumerable<object> @params)
{
IObservable<Foo> fooObservable = _resources.Get(@params);
IObservable<Bar> barObservable = CONVERT_SOME_HOW(fooObservable);
return barObservable;
}
+3
2 answers
As with LINQ to Objects, use the projection:
var observableB = observableA.Select(a => new B(a));
(Obviously, adjust according to your conversion.)
Assuming that I understood the question correctly. It is not clear what you mean by "when the subscription to the first observer is completed."
+7