Internal Access Modifier In C#
In this article I will explain internal access modifier in C#.
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.
// String Variable declared as internal
internal string name;
public void print()
Console.WriteLine("\nMy name is " + name);
static void Main(string args)
accessmod nam = new accessmod();
Console.Write("Enter your name: ");
// Accepting value in internal variable
nam.name = Console.ReadLine();
The output of following program