开发者

What happened to the Rx Switch() operator?

I am working my way through the Hands-On-Labs for reactive extensions (Rx HOL .NET.pdf) which I downloaded from the data developer center (here) a few days ago.

I added these references to my project, using NuGet:

System.Reactive 1.0.10621.0

System.Reactive.Windows.Forms 1.0.10621.0

I'm almost done with the labs, but I've hit a snag trying to implement the .Switch() example, Visual Studio can't locate the extension method:

'System.IObservable' does not contain a definition开发者_StackOverflow中文版 for 'Switch' and no extension method 'Switch' accepting a first argument of type 'System.IObservable' could be found (are you missing a using directive or an assembly reference?)

Now I know this Hands On Labs document is out of date, because certain things have been renamed (FromEvent became FromEventPattern) and certain things were removed (RemoveTimeStamp) and this document does not reflect that. For the life of me I cannot guess what they renamed Switch to be, or figure out what assembly they might have moved it to, or find a comprehensive list of release notes that indicate it was removed.

Anyone know where I can find Switch and what it's current name is?


The Switch extension method doesn't extend IObservable<T> - it extends IObservable<IObservable<T>>. The full signature is:

IObservable<TSource> Switch<TSource>(this IObservable<IObservable<TSource>> sources)

Try typing Observable.Empty<IObservable<object>>(). and see if Switch appears then.

If not, check your using namespace declarations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜