Internal Access Modifier In C#

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


The internal access specifier expose its member variables and methods from other functions and objects, in the current namespace. The variable or classes that are declared with internal can be access by any member within application. In C# programming It is the default access specifiers for a class.


In same assembly (public) 
Can be accessed by objects of the class.
Can be accessed by derived classes.

In other assembly (internal) 
Cannot be accessed by object.
Cannot be accessed by derived classes


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text; 

namespace Internal_Access_Specifier


    class accessmod


        // String Variable declared as internal

        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.