Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

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
   }
}
Show:
© 2015 Microsoft