IObservable ambiguous reference error

99封情书 提交于 2019-12-05 06:43:47
Sheridan

When you reference IObservable, either use

System.Reactive.IObservable<T>

or

System.IObservable<T>

UPDATE>>>

Ahhhh, now that you've added the image, I see your problem. You have two System.IObservable classes... what idiots those Reactive guys are!

Anyway, take a look at these posts:

How to access a type with same fully qualified name in 2 different DLLs

Extern alias walkthrough

It's not pretty, but it should help you.

When you say you are using the .Net 4 version of Rx, which version of Rx are you using? 1.1 or 2.x? If using 2.x, you shouldn't have a reference to System.Reactive, but rather System.Reactive.Core. I suspect you upgraded this project from .Net 3.5 but didn't update all of your necessary references. Make sure the version of Rx you are using isn't for Silverlight 4 or .Net 3.5 (which didn't have IObservable/IObserver in the core).

It may be easiest if you just remove the references to reactive and have nuget re-add them for you using the Reactive Extensions - WPF Helpers version. Note: You may need to change your imports for classes using Rx to import System.Reactive.Linq if you are using the older version that had the extension methods in the older System.Linq namespace.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!