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.
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()) {}
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: