Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0515

'function' : access modifiers are not allowed on static constructors

A static constructor cannot have an access modifier.

The following sample generates CS0515:

// CS0515.cs
public class Clx
{
    public static void Main()
    {
    }
}

public class Clz
{
    public static Clz()   // CS0515, remove public keyword
    {
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft