From b3822684b060a3d438d0ec11ad9d429c6a2c0b0e Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 23 Jul 2024 09:30:50 -0400 Subject: [PATCH] Clarify top-level access modifiers Fixes #41870. One statement on `file` access stated correctly that `file` access is only allowed on top-level types. Another statement didn't include that note. --- .../programming-guide/classes-and-structs/access-modifiers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md b/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md index 2fc42d93fb2ac..2f56bc90a613a 100644 --- a/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md +++ b/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md @@ -41,7 +41,7 @@ When one declaration of a [partial class or partial method](./partial-classes-an ## Class and struct accessibility -Classes and structs declared directly within a namespace (aren't nested within other classes or structs) can be either `public` or `internal`. `internal` is the default if no access modifier is specified. +Classes and structs declared directly within a namespace (aren't nested within other classes or structs) can have `public`, `internal` or `file` access. `internal` is the default if no access modifier is specified. Struct members, including nested classes and structs, can be declared `public`, `internal`, or `private`. Class members, including nested classes and structs, can be `public`, `protected internal`, `protected`, `internal`, `private protected`, or `private`. Class and struct members, including nested classes and structs, have `private` access by default.