|
1 | 1 | ---
|
2 | 2 | title: What's new in C# 11 - C# Guide
|
3 | 3 | description: Get an overview of the new features coming in C# 11.
|
4 |
| -ms.date: 08/16/2022 |
| 4 | +ms.date: 11/21/2022 |
5 | 5 | ---
|
6 | 6 | # What's new in C# 11
|
7 | 7 |
|
8 |
| -> [!IMPORTANT] |
9 |
| -> These are currently preview features. You must [set `<LangVersion>` to `preview`](../language-reference/compiler-options/language.md#langversion) to enable these features. Any feature may change before its final release. These features may not all be released in C# 11. Some may remain in a preview phase for longer based on feedback on the feature. |
10 |
| -
|
11 |
| -The following feature is available in Visual Studio 2022 version 17.4: |
12 |
| - |
13 |
| -- [File-scoped types](#file-scoped-types) |
14 |
| - |
15 |
| -The following features are available in Visual Studio 2022 version 17.3: |
| 8 | +The following features were added in C# 11: |
16 | 9 |
|
| 10 | +- [Raw string literals](#raw-string-literals) |
17 | 11 | - [Generic math support](#generic-math-support)
|
| 12 | +- [Generic attributes](#generic-attributes) |
| 13 | +- [UTF-8 string literals](#utf-8-string-literals) |
| 14 | +- [Newlines in string interpolation expressions](#newlines-in-string-interpolations) |
| 15 | +- [List patterns](#list-patterns) |
| 16 | +- [File-local types](#file-local-types) |
| 17 | +- [Required members](#required-members) |
18 | 18 | - [Auto-default structs](#auto-default-struct)
|
19 | 19 | - [Pattern match `Span<char>` on a constant `string`](#pattern-match-spanchar-or-readonlyspanchar-on-a-constant-string)
|
20 | 20 | - [Extended `nameof` scope](#extended-nameof-scope)
|
21 | 21 | - [Numeric IntPtr](#numeric-intptr-and-uintptr)
|
22 |
| -- [UTF-8 string literals](#utf-8-string-literals) |
23 |
| -- [Required members](#required-members) |
24 | 22 | - [`ref` fields and `scoped ref`](#ref-fields-and-ref-scoped-variables)
|
25 |
| - |
26 |
| -The following features are available in Visual Studio 2022 version 17.2: |
27 |
| - |
28 |
| -- [Raw string literals](#raw-string-literals) |
29 | 23 | - [Improved method group conversion to delegate](#improved-method-group-conversion-to-delegate)
|
30 | 24 | - [Warning wave 7](../language-reference/compiler-messages/warning-waves.md#cs8981---the-type-name-only-contains-lower-cased-ascii-characters)
|
31 | 25 |
|
32 |
| -The following features are available in Visual Studio 2022 version 17.1: |
33 |
| - |
34 |
| -- [Generic attributes](#generic-attributes) |
35 |
| -- [Newlines in string interpolation expressions](#newlines-in-string-interpolations) |
36 |
| -- [List patterns](#list-patterns) |
37 |
| - |
38 |
| -You can download the latest [Visual Studio 2022](https://visualstudio.microsoft.com/vs/). You can also try all these features with the preview release of the .NET 7 SDK, which can be downloaded from the [all .NET downloads](https://dotnet.microsoft.com/download/dotnet) page. |
| 26 | +You can download the latest [Visual Studio 2022](https://visualstudio.microsoft.com/vs/). You can also try all these features with the .NET 7 SDK, which can be downloaded from the [.NET downloads](https://dotnet.microsoft.com/download/dotnet) page. |
39 | 27 |
|
40 | 28 | We're interested in your feedback on these features. If you find issues with any of these new features, create a [new issue](https://github.com/dotnet/roslyn/issues/new/choose) in the [dotnet/roslyn](https://github.com/dotnet/roslyn) repository.
|
41 | 29 |
|
@@ -197,7 +185,7 @@ You can declare `ref` fields inside a [`ref struct`](../language-reference/built
|
197 | 185 |
|
198 | 186 | You can add the [`scoped`](../language-reference/statements/declarations.md#scoped-ref) modifier to any `ref` declaration. This limits the [scope](../language-reference/keywords/method-parameters.md#scope-of-references-and-values) where the reference can escape to.
|
199 | 187 |
|
200 |
| -## File scoped types |
| 188 | +## File local types |
201 | 189 |
|
202 | 190 | Beginning in C# 11, you can use the `file` access modifier to create a type whose visibility is scoped to the source file in which it is declared. This feature helps source generator authors avoid naming collisions. You can learn more about this feature in the article on [file-scoped types](../language-reference/keywords/file.md) in the language reference.
|
203 | 191 |
|
|
0 commit comments