Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

protected internal [duplicate]

The C# Language Reference on MSDN defines 'protected internal' as "Access is limited to the current assembly or types derived from the containing class". But from a semantic point of view, 'protected internal' sounds to me like 'both protected and internal' which means the member will be accessible only to those derived classes with in the same assembly. Is there any access modifier that has a meaning to the same effect?

like image 825
Asegid Debebe Avatar asked Sep 30 '12 13:09

Asegid Debebe


People also ask

What does protected internal mean?

protected internal: The type or member can be accessed by any code in the assembly in which it's declared, or from within a derived class in another assembly. private protected: The type or member can be accessed by types derived from the class that are declared within its containing assembly.

What does protected internal access modifier mean?

In c#, the protected internal modifier is used to specify that access is limited to the current assembly or types derived from the containing class. The type or member can be accessed by any code in the same assembly or any derived class in another assembly.

What is private protected in C#?

A private protected member is accessible by types derived from the containing class, but only within its containing assembly. For a comparison of private protected with the other access modifiers, see Accessibility Levels. The private protected access modifier is valid in C# version 7.2 and later.

Who can access a method that is marked as protected?

Protected means the member can only be accessed by a deriving type (child class accessing a super class). Protected internal is a combonation of both of them. It can only be accessed within the same assembly and it can only be accessed as a child class.


1 Answers

C# does not have any such access modifier.

However, the CLR does support it, as the FamANDAssem access level (protected internal is FamORAssem)

like image 50
SLaks Avatar answered Oct 18 '22 13:10

SLaks