Protected Internal Access Modifier In C#

In this article I will explain protected internal access modifier in C#.
  • 5399


The protected internal access specifier allows its members to be accessed in any class in the same assembly, including derived classes. However, this access specifier rarely used in C# programming but it becomes important when we want to use the concept of inheritance in the program.

The protected internal accessibility means protected OR internal, not protected AND internal.


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Internal_Access_Specifier


    class accessmod


        // String Variable declared as protected internal

        protected internal string name;

        public void print()


            Console.WriteLine("\nMy name is " + name);



     class Program


        static void Main(string[] args)


            accessmod nam = new accessmod();

            Console.Write("Enter your name:  ");

            // Accepting value in internal variable

   = Console.ReadLine();







The output of following program


© 2020 DotNetHeaven. All rights reserved.