Accessibility
is a language feature and determines what is visible during compilation. For example private members are not visible outside their type. This rule is enforced by the compiler and allows for some separation of implementation from public members. It can be
worked around at runtime using reflection or sometimes by simply changing the type the value is accessed as (e.g. explicit interface implementations).
Visibility is too generic a term to be descriptive. You'd need to quote some resources so we can see the context. IL does expose more accessibility modifiers than C# or other .NET languages.
In C# top level types must be public or internal. The other accessibility modifiers do not make sense on a top level type.
- protected would mean only derived types have access. A derived type cannot be more accessible than its base type so protected doesn't make sense on a root type.
- private would mean no one outside the type can access it. But if no one can access the type then it isn't usable and therefore shouldn't exist.
- protected internal would mean only types in the same assembly and derived types. Given the discussion of protected earlier it doesn't make sense so you're just left with internal which is supported
- private protected would mean only types that derive from the type in the same assembly. Since protected doesn't make sense nor does private then this accessibility wouldn't either.
Nested types do have a parent (owner) type. Therefore all the accessibility modifiers make sense here.
Michael Taylor http://www.michaeltaylorp3.net