This question already has an answer here:
I need to declare a member that is both protected AND internal. However, to my complete bafflement, I just discovered the hard way that "protected internal" actually means protected OR internal. Is there any access modifier that means protected AND internal?
How about internal class and protected member.
Though the CLR supports it, in C# there is no way to force a member to be protected AND internal.
Both C# and VB.NET combine access modifiers using a union, rather than intersection.
There is a workaround for this if you absolutely have to have it. It's not clean, but it works. You can create a helper class with an internal property on it, and then add a protected property of that inner class type to your class. The internal property of the protected property will only be accessible on a subclass within the owning assembly.
Example follows. I've used a generic on the chance that you might want multiple protected internal properties of different types. The generic will allow you to use the one inner class regardless of the desired property type.
You can't define protected AND internal members in C#, although it is supported by the CLR (
MemberAttributes.FamilyAndAssembly
)protected AND internal is not available in C# (or any other high level .NET language afaik). Although it is supported by the CLR and can be achieved in IL.
Citing from Equiso's link: