This documentation is archived and is not being maintained.

Compiler Error CS0526 

Error Message

Interfaces cannot contain constructors

Constructors cannot be defined for interfaces. A method is considered a constructor if it has the same name as the class and no return type.

The following sample generates CS0526:

// CS0526.cs
namespace x
{
   public interface clx
   {
      public clx()   // CS0526
      {
      }
   }

   public class cly
   {
      public static void Main()
      {
      }
   }
}
Show: