Skip to content

Commit c4a5471

Browse files
committed
Update csharp-13.md
Add note on unsafe
1 parent af2fdc4 commit c4a5471

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/csharp/whats-new/csharp-13.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ In C# 13, `async` methods can declare `ref` local variables, or local variables
8282

8383
This relaxed restriction enables the compiler to allow verifiably safe use of `ref` local variables and `ref struct` types in more places. You can safely use types like <xref:System.ReadOnlySpan%601?displayProperty=nameWithType> in these methods. The compiler tells you if you've violated safety rules.
8484

85+
In the same fashion, C# 13 allows `unsafe` contexts in iterator methods, provided that no unsafe code appears in the same context as the `yield return` statements.
86+
8587
## See also
8688

8789
- [What's new in .NET 9](../../core/whats-new/dotnet-9/overview.md)

0 commit comments

Comments
 (0)