Protected Means, we can access this member only in a deriving class, and internal means we can access this member in any type in the same assembly using a object.
So can I consider a Protected Internal member as a public member in the same assembly. and as a protected member in the different assembly.
EDIT:
namespace pracConsole
{
class Class1
{
protected internal int val;
public int hello()
{
Console.WriteLine("This is method pracConsole.hello");
Console.ReadLine();
return 1;
}
}
class program
{
static void Main(string[] args)
{
Class1 _class1 = new Class1();
_class1.val = 3;
_class1.hello();
Console.ReadLine();
}
}
}
See I am able to access, protected internal in a non deriving class…so its working as public in same assembly..what do you say.
It’s a confusing one.
protected means “only this class and derived classes”.
internal means “only classes in this assembly”.
protected internal means “protected OR internal” (any class in the same assembly, or any derived class – even if it is in a different assembly).
i.e. it does not mean “protected AND internal” (only derived classes within the same assembly).