From 69f41a89342d78b33679dd22596cad660b7ff9c0 Mon Sep 17 00:00:00 2001 From: Olabamiji Oyetubo <60369677+bigboybamo@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:36:22 +0100 Subject: [PATCH 1/2] Update access-modifiers.md Added description for file access type modifier --- .../programming-guide/classes-and-structs/access-modifiers.md | 2 ++ 1 file changed, 2 insertions(+) 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 5543714e1a752..2fc42d93fb2ac 100644 --- a/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md +++ b/docs/csharp/programming-guide/classes-and-structs/access-modifiers.md @@ -73,6 +73,8 @@ To set the access level for a `class` or `struct` member, add the appropriate ke Finalizers can't have accessibility modifiers. Members of an `enum` type are always `public`, and no access modifiers can be applied. +The `file` access modifier is allowed only on top-level (non-nested) type declarations. + ## C# language specification [!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)] From 8084fd9300156e266372f527c74808a4eb1b4b47 Mon Sep 17 00:00:00 2001 From: Olabamiji Oyetubo <60369677+bigboybamo@users.noreply.github.com> Date: Wed, 8 Oct 2025 10:57:45 +0100 Subject: [PATCH 2/2] Update using.md --- docs/csharp/language-reference/statements/using.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/csharp/language-reference/statements/using.md b/docs/csharp/language-reference/statements/using.md index afe67b89d0db2..10b93e6601e12 100644 --- a/docs/csharp/language-reference/statements/using.md +++ b/docs/csharp/language-reference/statements/using.md @@ -37,6 +37,8 @@ When you declare several instances in one `using` statement, they are disposed i You can also use the `using` statement and declaration with an instance of a [ref struct](../builtin-types/ref-struct.md) that fits the disposable pattern. That is, it has an instance `Dispose` method that's accessible, parameterless, and has a `void` return type. +A `return` inside a `using` block still guarantees disposal, the compiler rewrites it into a `try/finally`, so the resource’s `Dispose` is always called before the method actually returns. + The `using` statement can also be of the following form: ```csharp