IObservable含糊不清的参考错误 [英] IObservable ambiguous reference error
问题描述
我在WPF应用程序中使用了Reactive扩展.而且在使用它时,我遇到了模棱两可的参考错误.
The type 'System.IObservable<T>' exists in both 'mscorlib.dll' and 'System.Reactive.dll'
我也尝试使用完全限定的名称,并尝试了解决方案
引用IObservable
时,要么使用
System.Reactive.IObservable<T>
或
System.IObservable<T>
更新>>>
嗯,既然您已经添加了图片,我就看到了您的问题.您有两个System.IObservable类...那些反应性家伙是什么白痴!
无论如何,看看这些帖子:
外部别名演练 >
这不是很漂亮,但它可以为您提供帮助.
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 error
Any 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
It's not pretty, but it should help you.
这篇关于IObservable含糊不清的参考错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!