New protected member declared in struct

c#

Solution

Because this is a struct, it cannot be overridden. It seems the C# compiler wants sealed types like structs to use the 'private' keyword rather than the 'protected' keyword, even though functionally there isn't any difference. Use this instead:

struct Foo {
    private Object _bar;
}

Problem

The C# compiler complains about the following code containing `new protected member declared in struct`. What is the problem? ``` struct Foo { protected Object _bar; } ```

Original source