This documentation is archived and is not being maintained.

Compiler Error CS0540

'interface member' : containing class does not implement interface 'interface'

You attempted to implement an interface member in a class that does not derive from the interface. You should either delete the implementation of the interface member or add the interface to the base-class list of the class.

The following sample generates CS0540:

// CS0540.cs
namespace x
{
   interface I
   {
      void m();
   }

   public class clx
   {
      void I.m()   // CS0540
      {
      }

      public static int Main()
      {
         return 0;
      }
   }
}
Show: