Share via


Compiler Error CS1057

'member': static classes cannot contain protected members"

This error is generated by declaring a protected member inside a static class.

Example

The following example generates CS1057.

// CS1057.cs
using System;

static class Class1
{
    protected static int x;   // CS1057
    public static void Main()
    {
    }
}