0

I have Created Two Class Library projects (AssemblyA and AssemblyB) to distinguish the difference between the protected and protected internal access modifiers.

I have made a reference of AssemblyA in AssemblyB and used the Using Directive in the code of AssemblyB.

Class Library Project (AssemblyA)

using System;

namespace AssemblyA
{
    public class AClassA
    {
        protected int ID;
        protected internal int Age;
    }
}

Class library project (AssemblyB)

using System;
using AssemblyA;

namespace AssemblyB
{
    public class BclassA : AClassA
    {
        public void print()
        {           
            this.ID = 1;
            this.Age = 22;

            // I can access both these fields here.
            // How come the protected internal field gets the 
            // access when its between two assemblies?
        }       
    }
}
  • 5
    It would have been easier for you to simply click on the suggested topic when entering your question, as it surely was suggested as you typed your title. – MakePeaceGreatAgain Jan 11 '18 at 08:17
  • As for your title change, still, see duplicate: _"protected internal means "protected OR internal""_. – CodeCaster Jan 11 '18 at 08:38

0 Answers0