gpt4 book ai didi

wpf - IObservable含糊不清的引用错误

转载 作者:行者123 更新时间:2023-12-04 13:32:48 25 4
gpt4 key购买 nike

我在WPF应用程序中使用了Reactive扩展。并且在使用它时,我遇到了模棱两可的引用错误。

The type 'System.IObservable<T>' exists in both 'mscorlib.dll' and 'System.Reactive.dll'

我也尝试使用完全限定的名称,也尝试了 this url,但是没有任何运气。我正在使用.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类...这些 react 性家伙是什么白痴!

无论如何,看看这些帖子:

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

Extern alias walkthrough

它不是很漂亮,但可以为您提供帮助。

关于wpf - IObservable含糊不清的引用错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17928507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com