This code does not compile:
internal class Foo {}
public abstract class SomeBaseClass
{
protected internal void ProcessFoo(Foo value)
{
// doing something...
}
}
The compile fails stating:
Inconsistent accessibility: parameter type Foo
is less accessible than method SomeBaseClass.ProcessFoo
protected: The type or member can be accessed only by code in the same class , or in a class that is derived from that class . internal: The type or member can be accessed by any code in the same assembly, but not from another assembly.
A protected internal member of a base class is accessible from any type within its containing assembly. It is also accessible in a derived class located in another assembly only if the access occurs through a variable of the derived class type.
Protected Internal access modifier is combination Protected or Internal. Protected Internal Member can be available within the entire assembly in which it declared either creating object or by inherited that class. And can be accessible outside the assembly in a derived class only.
The short answer is that it doesn't matter. Public methods of an internal class are internal. To the compiler, the internal/public method distinction only matters for public classes.
Apparently, protected internal
means protected
or internal
and not protected
and internal
as I had believed.
Credit to Michael Liu
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With