Skip to content

Commit

Permalink
Update csharp-13.md
Browse files Browse the repository at this point in the history
Add note on unsafe
  • Loading branch information
BillWagner committed Jul 1, 2024
1 parent af2fdc4 commit c4a5471
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/csharp/whats-new/csharp-13.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ In C# 13, `async` methods can declare `ref` local variables, or local variables

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.

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.

## See also

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

0 comments on commit c4a5471

Please sign in to comment.