This topic has not yet been rated - Rate this topic

Compiler Error CS0515 

Error Message

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

A static constructor cannot have an access modifier.

Example

The following sample generates CS0515:

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

public class Clz
{
    public static Clz()   // CS0515, remove public keyword
    {
    }
}
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ