All types have an accessibility modifier that governs their accessibility from other types. The following table describes the type accessibilities supported by the runtime.
Accessibility | Description |
|---|
public | The type is accessible by all assemblies. |
assembly | The type is accessible only from within the assembly. |
The accessibility of a nested type depends on its accessibility domain, which is determined by both the declared accessibility of the member and the accessibility domain of the immediately containing type. However, the accessibility domain of a nested type cannot exceed that of the containing type.
The accessibility domain of a nested member M declared in a type T within a program P is defined as follows (noting that M might itself be a type):
If the declared accessibility of M is public, the accessibility domain of M is the accessibility domain of T.
If the declared accessibility of M is protected internal, the accessibility domain of M is the intersection of the accessibility domain of T with the program text of P and the program text of any type derived from T declared outside P.
If the declared accessibility of M is protected, the accessibility domain of M is the intersection of the accessibility domain of T with the program text of T and any type derived from T.
If the declared accessibility of M is internal, the accessibility domain of M is the intersection of the accessibility domain of T with the program text of P.
If the declared accessibility of M is private, the accessibility domain of M is the program text of T.