Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# CodeAnalysis ProtectedAndInternal vs ProtectedOrInternal

I'm unclear about the distinction between the Accessibility values ProtectedAndInternal and ProtectedOrInternal.

I found a reference stating ProtectedOrInternal maps to the source code construct protected internal.

But -- assuming that's correct -- what does it mean for something to be both protected and internal?


1 Answers

ProtectedOrInternal corresponds to protected internal:

The protected internal keyword combination is a member access modifier. A protected internal member is accessible from the current assembly or from types that are derived from the containing class. For a comparison of protected internal with the other access modifiers, see Accessibility Levels.

ProtectedAndInternal corresponds to private protected:

The private protected keyword combination is a member access modifier. 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.

like image 123
Paulo Morgado Avatar answered Mar 26 '26 15:03

Paulo Morgado



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!