Can someone please explain the difference between the protected
and protected internal
modifiers in C#? It looks like their behavior is identical.
C# – the difference between ‘protected’ and ‘protected internal’
access-modifierscnet
Related Topic
- C# – How to enumerate an enum
- Java – the difference between public, protected, package-private and private in Java
- C# – What are the correct version numbers for C#
- C# – What’s the difference between the ‘ref’ and ‘out’ keywords
- C# – In C#, what is the difference between public, private, protected, and having no access modifier
- .net – Difference between decimal, float and double in .NET
- C# – Difference Between Select and SelectMany
- .net – the difference between .NET Core and .NET Standard Class Library project types
Best Answer
The "protected internal" access modifier is a union of both the "protected" and "internal" modifiers.
From MSDN, Access Modifiers (C# Programming Guide):
protected:
internal:
protected internal:
Note that:
protected internal
means "protected
ORinternal
" (any class in the same assembly, or any derived class - even if it is in a different assembly)....and for completeness:
private:
public:
private protected: