Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0522 

Error Message

'constructor' : structs cannot call base class constructors

A struct cannot call a base class constructor; remove the call to the base class constructor.

The following sample generates CS0522:

// CS0522.cs
public class clx
{
   public clx(int i)
   {
   }

   public static void Main()
   {
   }
}

public struct cly
{
   public cly(int i):base(0)   // CS0522
   // try the following line instead
   // public cly(int i)
   {
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft