The following example shows that the protected internal member of the class will have the same visibility as a private member of the class.
protected internal string Model;
public void SetModel()
Console.WriteLine("Enter the model name:");
Model = Console.ReadLine();
public void DisplayModel()
Console.WriteLine("The model is:(0)", Model);
static void Main(string args)
Car Ford = new Car();
Ford.SetModel(); // Accepts the model name
Ford.DisplayModel(); //Display the model name
// Ford.Honk(); error! private members Cannot be Accessed outside the class definations */
// Console.WriteLine("Ford.Model"); error! protected internal members Cannot be Accessed outside the class defination /*
Note:- The SetModel () and DisplayModel () functions can be called from the Ford object defind in the Main () function. However, the Model variable cannot be accessed through the Ford object because it is a protected internal member variable. Similarly, the Honk () function cannot be accessed through the Ford object because it is also a private member function.
C Sharp Access specifier Related Contents.
Understanding the public Access specifier in c#:
Understanding The private access specifier in c Sharp.
Understanding The protected access specifier in c Sharp.
Understanding The internal access specifier in c Sharp.
if...else construct in c sharp.