C# – Why is internal protected not more restrictive than internal

access-modifiersc++

I'd like to create an internal auto-property:

internal bool IP { get; protected internal set; }

I thought it would be possible to make the setter protected or protected internal – but I always get the error accessibility modifier must be more restrictive than the property. Isn't that the case? Private does not help me, here.

EDIT:
The question is: How do I implement an auto-property with a internal getter and a protected setter?

Best Solution

It's effectively protected or internal, not and. It's accessible both by derived classes and types in the same assembly. It's a common misconception to think protected internal means accessible only to derived classes in the same assembly.