简体   繁体   中英

The type or namespace name 'IObservable' could not be found. Are you missing a using or directive or assembly reference?

I'm attempting to implement the IObservable interface in C# using Mono 2.10.6, and Monodevelop 2.8.2, and I keep getting the following error:

The type or namespace name 'IObservable' could not be found. Are you missing a using or directive or assembly reference?

I'm using:

  • System
  • System.Collections.Generic;
  • System.Collections.ObjectModel

I have references to:

  • System
  • System.Core

Seems that you have to compile for .NET 4.0:

#if NET_4_0

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

#endif

(Taken from this one ).

Maybe you have not set to .NET 4.0 as the target framework?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question The type or namespace name ‘player’ could not be found. (Are you missing a directive or an assembly reference) CS0246: The type or namespace name `T' could not be found. Are you missing a using directive or an assembly reference? in c# error CS0246: The type or namespace name `AForge' could not be found. Are you missing a using directive or an assembly reference? Type or namespace name could not be found (missing using directive or assembly reference?) The type or namespace name 'My_Interface_Name' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'FacebookSessionClient' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'SignInManager' could not be found (are you missing a using directive or an assembly reference?) error CS0246: The type or namespace name 'IWebHostEnvironment' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'PrintDocument' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'OleDbConnection' could not be found (are you missing a using directive or an assembly reference?)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM