--- description: "Accessibility Levels - C# Reference" title: "Accessibility Levels" ms.date: 01/21/2026 helpviewer_keywords: - "access modifiers [C#], accessibility levels" - "accessibility levels" --- # Accessibility levels (C# reference) Use the access modifiers `public`, `protected`, `internal`, or `private` to specify one of the following declared accessibility levels for members. - [`public`](public.md): Access isn't restricted. - [`protected`](protected.md): Access is limited to the containing class or types derived from the containing class. - [`internal`](internal.md): Access is limited to the current assembly. - [`protected internal`](protected-internal.md): Access is limited to the current assembly or types derived from the containing class. - [`private`](private.md): Access is limited to the containing type. - [`private protected`](private-protected.md): Access is limited to the containing class or types derived from the containing class within the current assembly. [!INCLUDE[csharp-version-note](../includes/initial-version.md)] Top-level (non-nested) types can use the [file](../../language-reference/keywords/file.md) modifier. The `file` modifier restricts access to code in the same source file. You can't combine the `file` modifier with any access modifier. Use only one access modifier for a member or type, except when you use the `protected internal` or `private protected` combinations. Don't use access modifiers on namespaces. Namespaces have no access restrictions. Depending on the context in which a member declaration occurs, only certain declared accessibilities are permitted. If you don't specify an access modifier in a member declaration, a default accessibility is used. Top-level types, which aren't nested in other types, can only have `internal` or `public` accessibility. The default accessibility for these types is `internal`. Nested types, which are members of other types, can have declared accessibilities as indicated in the following table. | Members of | Default member accessibility | Allowed declared accessibility of the member | |-------------|------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | `enum` | `public` | None | | `class` | `private` | `public`

`protected`

`internal`

`private`

`protected internal`

`private protected` | | `interface` | `public` | `public`

`protected`

`internal`

`private`\*

`protected internal`

`private protected` | | `struct` | `private` | `public`

`internal`

`private` | \* An `interface` member with `private` accessibility must have a default implementation. > [!NOTE] > If you modify a class or struct with the [`record`](../builtin-types/record.md) keyword modifier, use the same access modifiers. > Also, with the [`record`](../builtin-types/record.md) modifier, the default member accessibility is still `private` for both class and struct. The accessibility of a nested type depends on its [accessibility domain](./accessibility-domain.md), which the declared accessibility of the member and the accessibility domain of the immediately containing type determine. However, the accessibility domain of a nested type can't exceed that of the containing type. ## C# Language Specification [!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)] ## See also - [C# Keywords](./index.md) - [Access Modifiers](./access-modifiers.md) - [Accessibility Domain](./accessibility-domain.md) - [Restrictions on Using Accessibility Levels](./restrictions-on-using-accessibility-levels.md) - [Access Modifiers](../../programming-guide/classes-and-structs/access-modifiers.md) - [public](./public.md) - [private](./private.md) - [protected](./protected.md) - [internal](./internal.md)