Share via


Compiler Error CS0541

'declaration' : explicit interface declaration can only be declared in a class or struct

An explicit interface declaration was found outside a class or struct.

The following sample generates CS0541:

// CS0541.cs
namespace x
{
   interface IFace
   {
      void F();
   }

   interface IFace2 : IFace
   {
      void IFace.F();   // CS0541
   }
}