Skip to main content
A protected internal field is a class-level variable declared with a compound access modifier that grants the union of both protected and internal accessibility. It represents a logical OR operation between the two modifiers. The field is accessible to any code within the same assembly (the internal aspect) and to any derived class, regardless of whether that derived class resides in the same assembly or a different one (the protected aspect).

Syntax

The modifiers can be written in either order, though protected internal is the standard C# convention.

Accessibility Matrix

The compiler enforces the following access rules for a protected internal field:

Mechanical Demonstration

The following code blocks illustrate the compiler’s behavior when resolving access to a protected internal field across assembly boundaries. Assembly A (The defining assembly)
Assembly B (An external assembly referencing Assembly A)

Technical Distinctions

  • Instance Qualification Rule: When a protected internal field is accessed from a derived class in a different assembly, it is subject to standard protected access rules. It can only be accessed through an instance of the derived class type (or a type derived from it), not directly through an instance of the base class type.
  • Contrast with private protected: Do not confuse protected internal (Logical OR) with private protected (Logical AND). A private protected field is accessible only to derived classes that reside within the same assembly.
Tired of Poor C# Skills? Fix That With Deep Grasping!Learn More