【问题标题】:The type or namespace name 'IObservable' could not be found. Are you missing a using or directive or assembly reference?找不到类型或命名空间名称“IObservable”。您是否缺少使用或指令或程序集参考?
【发布时间】:2011-12-23 06:14:41
【问题描述】:

我正在尝试使用 Mono 2.10.6 和 Monodevelop 2.8.2 在 C# 中实现 IObservable 接口,但我不断收到以下错误:

找不到类型或命名空间名称“IObservable”。你是 缺少使用或指令或程序集引用?

我正在使用:

  • 系统
  • System.Collections.Generic;
  • System.Collections.ObjectModel

我参考了:

  • 系统
  • System.Core

【问题讨论】:

  • 您的目标是什么框架版本? IObservable 是 .NET 4.0 的新手

标签: c# mono monodevelop


【解决方案1】:

看来你必须为 .NET 4.0 编译:

#if NET_4_0

namespace System{
  public interface IObservable<out T>
  {
    IDisposable Subscribe (IObserver<T> observer);
  }
}

#endif

(取自this one)。

也许您还没有将 .NET 4.0 设置为目标框架?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-08
    • 1970-01-01
    • 2015-06-09
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 2012-05-01
    • 2020-11-28
    相关资源
    最近更新 更多