Compiler Error CS0540

'interface member' : containing type 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.

Example

The following sample generates CS0540.

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

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

// OK
public class Cly : I
{
   void I.m() {}
   public static void Main() {}
}

The following sample generates CS0540.

// CS0540_b.cs
using System;
class C {
   void IDisposable.Dispose() {}   // CS0540
}

class D : IDisposable {
   void IDisposable.Dispose() {}
   public void Dispose() {}

   static void Main() {
      using (D d = new D()) {}
   }
}