IObservable含糊不清的参考错误

编程入门 行业动态 更新时间:2024-10-06 18:31:53
本文介绍了IObservable含糊不清的参考错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在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 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

Extern alias walkthrough

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

更多推荐

IObservable含糊不清的参考错误

本文发布于:2023-11-26 10:14:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1633673.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不清   错误   IObservable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!