This topic has not yet been rated - Rate this topic

Compiler Error CS0522

'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)
   {
   }
}
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ