Skip to content

Commit 5735e76

Browse files
authored
Modify using statement (#48970)
* Update access-modifiers.md Added description for file access type modifier * Update using.md
1 parent cb1cfee commit 5735e76

File tree

1 file changed

+2
-0
lines changed
  • docs/csharp/language-reference/statements

1 file changed

+2
-0
lines changed

docs/csharp/language-reference/statements/using.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ When you declare several instances in one `using` statement, they are disposed i
3737

3838
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.
3939

40+
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.
41+
4042
The `using` statement can also be of the following form:
4143

4244
```csharp

0 commit comments

Comments
 (0)