我在WPF应用程序中使用了Reactive扩展.而且在使用它时,我遇到了模棱两可的参考错误.
The type 'System.IObservable<T>' exists in both 'mscorlib.dll' and 'System.Reactive.dll'我也尝试使用完全限定的名称,并尝试了此网址也是如此,但是没有任何运气.我正在使用.NET 4.0版本的Reactive Extensions.
我的代码:
using System; // mscorlib.dll using Rx = System.Reactive; public Rx.IObservable<int> BytesReceived { get { return _bytesReceivedSubj; } } // Not valid as IObservable is in System namespace of System.Reactive. public IObservable<int> BytesReceived { get { return _bytesReceivedSubj; } } // With this I'm getting ambiguous reference error
任何想法我该如何解决?
谢谢
解决方案引用IObservable时,要么使用
System.Reactive.IObservable<T>或
System.IObservable<T>更新>>>
嗯,既然您已经添加了图片,我就看到了您的问题.您有两个System.IObservable类...那些反应性家伙是什么白痴!
无论如何,看看这些帖子:
如何可以在2个不同的DLL中访问具有完全限定名称的类型
外部别名演练
这不是很漂亮,但它可以为您提供帮助.
I'm using Reactive extensions in my WPF application. And while using it I'm getting below ambiguous reference error.
The type 'System.IObservable<T>' exists in both 'mscorlib.dll' and 'System.Reactive.dll'I tried with fully qualified name also and tried this url as well, but didn't get any luck. I'm using .NET 4.0 version of Reactive Extensions.
My Code:
using System; // mscorlib.dll using Rx = System.Reactive; public Rx.IObservable<int> BytesReceived { get { return _bytesReceivedSubj; } } // Not valid as IObservable is in System namespace of System.Reactive. public IObservable<int> BytesReceived { get { return _bytesReceivedSubj; } } // With this I'm getting ambiguous reference errorAny idea how can i resolve this?
Thanks
解决方案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.
更多推荐
IObservable含糊不清的参考错误
发布评论