A new version of the .Net framework and C# offer a new access modifier: private protected
. In order to access such a member, the class must both
- reside in the same assembly and
- derive from the defining class.
(In contrast to protected internal
where fulfilling one of the conditions is enough)
For testing purposes, the InternalsVisibleTo
attribute comes in very handy when I like to access non-public members of a class from my test class which is in a different assembly.
How does private protected
interact with the InternalsVisibleTo
attribute? Can I access such member from a class residing in the "friend" assembly which derives from the original class?
(I cannot try that on my machine, because the version of Visual Studio and C# is too old).
private protected
too, although they everywhere(f.e. here or here) mention that it applies only tointernal
members. – Morula