Skip to content

Commit 4257ed8

Browse files
authored
Publish the C# 9 alpha branch (#52889)
* Publish the C# 9 alpha branch Start the process of publishing the early alpha drafts in favor of the current committee working draft. * fix branch name. * Fix build warnings New version means lots of new clauses. * Add items to TOC Add clause number to the TOC. * Fix spec links * Replace links Replace all links to the C# 9 feature specs with the corresponding location in the C# 9 alpha draft of the C# standard.
1 parent 5405ef6 commit 4257ed8

50 files changed

Lines changed: 128 additions & 205 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.openpublishing.publish.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
{
5656
"path_to_root": "_csharpstandard",
5757
"url": "https://github.com/dotnet/csharpstandard",
58-
"branch": "draft-v8",
58+
"branch": "alpha-v9",
5959
"include_in_build": true,
6060
"branch_mapping": {}
6161
},

.openpublishing.redirection.csharp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@
18551855
},
18561856
{
18571857
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-9.0/index.md",
1858-
"redirect_url": "/dotnet/csharp/language-reference/proposals/csharp-9.0/records"
1858+
"redirect_url": "/dotnet/csharp/language-reference/language-specification/classes#1516-synthesized-record-class-members"
18591859
},
18601860
{
18611861
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-10.0/index.md",

docfx.json

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
},
5050
{
5151
"files": [
52-
"csharp-9.0/*.md",
5352
"csharp-10.0/*.md",
5453
"csharp-11.0/*.md",
5554
"csharp-12.0/*.md",
@@ -63,11 +62,7 @@
6362
"exclude": [
6463
"**/README.md",
6564
"inactive/**",
66-
"rejected/**",
67-
"csharp-9.0/nullable-reference-types-specification.md",
68-
"csharp-9.0/nullable-constructor-analysis.md",
69-
"csharp-9.0/nullable-parameter-default-value-analysis.md",
70-
"csharp-9.0/skip-localsinit.md"
65+
"rejected/**"
7166
]
7267
},
7368
{
@@ -511,7 +506,6 @@
511506
},
512507
"ms.date": {
513508
"_csharpstandard/standard/*.md": "09/12/2025",
514-
"_csharplang/proposals/csharp-9.0/*.md": "07/29/2020",
515509
"_csharplang/proposals/csharp-10.0/*.md": "08/07/2021",
516510
"_csharplang/proposals/csharp-11.0/*.md": "09/30/2022",
517511
"_csharplang/proposals/csharp-12.0/*.md": "08/15/2023",
@@ -626,23 +620,6 @@
626620
"_csharpstandard/standard/standard-library.md": "Standard library",
627621
"_csharpstandard/standard/documentation-comments.md": "Documentation comments",
628622
"_csharpstandard/standard/Bibliography.md": "Bibliography",
629-
"_csharplang/proposals/csharp-9.0/covariant-returns.md": "Covariant return types",
630-
"_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "Extending partial methods",
631-
"_csharplang/proposals/csharp-9.0/extension-getenumerator.md": "Extension GetEnumerator support in foreach",
632-
"_csharplang/proposals/csharp-9.0/function-pointers.md": "Function pointers",
633-
"_csharplang/proposals/csharp-9.0/init.md": "Init only setters",
634-
"_csharplang/proposals/csharp-9.0/lambda-discard-parameters.md": "Lambda discard parameters",
635-
"_csharplang/proposals/csharp-9.0/local-function-attributes.md": "Attributes on local functions",
636-
"_csharplang/proposals/csharp-9.0/module-initializers.md": "Module initializers",
637-
"_csharplang/proposals/csharp-9.0/native-integers.md": "Native sized integers",
638-
"_csharplang/proposals/csharp-9.0/patterns3.md": "Pattern matching changes",
639-
"_csharplang/proposals/csharp-9.0/records.md": "Records",
640-
"_csharplang/proposals/csharp-9.0/static-anonymous-functions.md": "Static anonymous functions",
641-
"_csharplang/proposals/csharp-9.0/target-typed-conditional-expression.md": "Target-typed conditional expression",
642-
"_csharplang/proposals/csharp-9.0/target-typed-new.md": "Target-typed new expressions",
643-
"_csharplang/proposals/csharp-9.0/top-level-statements.md": "Top-level statements",
644-
"_csharplang/proposals/csharp-9.0/unconstrained-type-parameter-annotations.md": "Unconstrained type parameter annotations",
645-
"_csharplang/proposals/csharp-9.0/variance-safety-for-static-interface-members.md": "Variance safety for static interface members",
646623
"_csharplang/proposals/csharp-10.0/record-structs.md": "Record structs",
647624
"_csharplang/proposals/csharp-10.0/parameterless-struct-constructors.md": "Parameterless struct constructors",
648625
"_csharplang/proposals/csharp-10.0/GlobalUsingDirective.md": "Global using directive",
@@ -755,23 +732,6 @@
755732
"_csharpstandard/standard/standard-library.md": "This appendix lists requirements of the specification library. The C# language relies on these types for some of its behavior.",
756733
"_csharpstandard/standard/documentation-comments.md": "This appendix describes XML comments that are used to document your program.",
757734
"_csharpstandard/standard/Bibliography.md": "This appendix lists external standards referenced in this specification.",
758-
"_csharplang/proposals/csharp-9.0/covariant-returns.md": "This feature specification describes covariant return types, where overriding member declarations can return a type derived from the overridden member declaration.",
759-
"_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "This feature specification describes extensions to partial methods. These extensions enable source generators to create or call partial methods.",
760-
"_csharplang/proposals/csharp-9.0/extension-getenumerator.md": "This feature specification describes the necessary pattern for an extension method to provide the GetEnumerator support in a foreach loop.",
761-
"_csharplang/proposals/csharp-9.0/function-pointers.md": "This feature specification describes function pointers, which are unmanaged delegates. They are typically used to avoid the allocations necessary to instantiate a delegate object.",
762-
"_csharplang/proposals/csharp-9.0/init.md": "This feature specification describes the rules for 'init' only setters in properties. These can be set only as part of an instantiation, using property initializer syntax.",
763-
"_csharplang/proposals/csharp-9.0/lambda-discard-parameters.md": "This feature specification describes the new language rules that enable the '_' to be a discard parameter in a lambda expression.",
764-
"_csharplang/proposals/csharp-9.0/local-function-attributes.md": "This feature specification describes rules to apply attributes on local functions.",
765-
"_csharplang/proposals/csharp-9.0/module-initializers.md": "This feature specification describes how to declare module initializers, which are methods called by the runtime when a module, or assembly, is loaded.",
766-
"_csharplang/proposals/csharp-9.0/native-integers.md": "This feature specification describes native sized integers, which are integer types that use the processor's natural integral types.",
767-
"_csharplang/proposals/csharp-9.0/patterns3.md": "This feature specification describes the additional pattern matching syntax added in C# 9.0. This includes relational patterns, 'and' and 'or' patterns, negated patterns and parenthesized patterns.",
768-
"_csharplang/proposals/csharp-9.0/records.md": "This feature specification describes records. Records are reference types that provide value based equality semantics.",
769-
"_csharplang/proposals/csharp-9.0/static-anonymous-functions.md": "This feature specification describes static anonymous functions. Static anonymous functions are lambda expressions that are prohibited from accessing variables in the enclosing scope. That prevents them from creating a closure.",
770-
"_csharplang/proposals/csharp-9.0/target-typed-conditional-expression.md": "This feature specification describes syntax rules to find a best match for the target of a conditional expression (?:).",
771-
"_csharplang/proposals/csharp-9.0/target-typed-new.md": "This feature specification describes the enhancements to 'new' where the target type can be inferred from the variable declaration.",
772-
"_csharplang/proposals/csharp-9.0/top-level-statements.md": "This feature specification describes top-level statements, which are program statements that replace the typical 'Main' method enclosed in a startup class.",
773-
"_csharplang/proposals/csharp-9.0/unconstrained-type-parameter-annotations.md": "This feature specification describes unconstrained type parameter annotations. This enables 'T?' to be used where 'T' is not constrained to be either a value type or a reference type.",
774-
"_csharplang/proposals/csharp-9.0/variance-safety-for-static-interface-members.md": "This feature specification describes variance safety for static interface members",
775735
"_csharplang/proposals/csharp-10.0/record-structs.md": "This feature specification describes record structs, which are structs where the compiler generates methods similar to those for record classes.",
776736
"_csharplang/proposals/csharp-10.0/parameterless-struct-constructors.md": "This feature specification parameterless struct constructors, which can now be declared for structs. The rules for when they are called describe behavior in arrays and other variable declarations.",
777737
"_csharplang/proposals/csharp-10.0/GlobalUsingDirective.md": "This feature specification describes global using directives, which add a using directive to every file compiled as part of an assembly.",
@@ -853,7 +813,6 @@
853813
"titleSuffix": {
854814
"docs/**/*.{md,yml}": ".NET",
855815
"_csharpstandard/standard/*.md": "C# language specification",
856-
"_csharplang/proposals/csharp-9.0/*.md": "C# feature specifications",
857816
"_csharplang/proposals/csharp-10.0/*.md": "C# feature specifications",
858817
"_csharplang/proposals/csharp-11.0/*.md": "C# feature specifications",
859818
"_csharplang/proposals/csharp-12.0/*.md": "C# feature specifications",

docs/core/compatibility/sdk/6.0/csharp-template-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Starting in .NET 6, the project templates that ship with the .NET SDK use the la
1010
- [Top-level statements](../../../../csharp/fundamentals/program-structure/top-level-statements.md)
1111
- [Global using directives](https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/GlobalUsingDirective.md)
1212
- [File-scoped namespaces](https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/file-scoped-namespaces.md)
13-
- [Target-typed new expressions](/dotnet/csharp/language-reference/proposals/csharp-9.0/target-typed-new)
13+
- [Target-typed new expressions](/dotnet/csharp/language-reference/language-specification/expressions#128172-object-creation-expressions)
1414
- [Nullable reference types](../../../../csharp/nullable-references.md)
1515
- [Async Main return values](../../../../csharp/fundamentals/program-structure/main-command-line.md#main-return-values)
1616

docs/csharp/fundamentals/program-structure/top-level-statements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ To return an exit code when the application ends, use the `return` statement. Th
7373

7474
- [Main() and command-line arguments](main-command-line.md)
7575
- [General structure of a C# program](index.md)
76-
- [Feature specification - Top-level statements](~/_csharplang/proposals/csharp-9.0/top-level-statements.md)
76+
- [Feature specification - Top-level statements](~/_csharpstandard/standard/basic-concepts.md#713-using-top-level-statements)

docs/csharp/language-reference/builtin-types/enum.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ For more information, see the following sections of the [C# language specificati
8787

8888
- [Enums](~/_csharpstandard/standard/enums.md)
8989
- [Enum values and operations](~/_csharpstandard/standard/enums.md#206-enum-values-and-operations)
90-
- [Enumeration logical operators](~/_csharpstandard/standard/expressions.md#12153-enumeration-logical-operators)
91-
- [Enumeration comparison operators](~/_csharpstandard/standard/expressions.md#12146-enumeration-comparison-operators)
90+
- [Enumeration logical operators](~/_csharpstandard/standard/expressions.md#12163-enumeration-logical-operators)
91+
- [Enumeration comparison operators](~/_csharpstandard/standard/expressions.md#12156-enumeration-comparison-operators)
9292
- [Explicit enumeration conversions](~/_csharpstandard/standard/conversions.md#1033-explicit-enumeration-conversions)
9393
- [Implicit enumeration conversions](~/_csharpstandard/standard/conversions.md#1024-implicit-enumeration-conversions)
9494

docs/csharp/language-reference/builtin-types/integral-numeric-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ For more information, see the following sections of the [C# language specificati
155155

156156
- [Integral types](~/_csharpstandard/standard/types.md#836-integral-types)
157157
- [Integer literals](~/_csharpstandard/standard/lexical-structure.md#6453-integer-literals)
158-
- [Native sized integral types](~/_csharplang/proposals/csharp-9.0/native-integers.md)
158+
- [Native sized integral types](~/_csharpstandard/standard/types.md#836-integral-types)
159159
- [Numeric `IntPtr` and `UIntPtr`](~/_csharplang/proposals/csharp-11.0/numeric-intptr.md)
160160

161161
## See also

docs/csharp/language-reference/builtin-types/record.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ For more information, see the [Classes](~/_csharpstandard/standard/classes.md) s
259259

260260
For more information about these features, see the following feature proposal notes:
261261

262-
- [Records](~/_csharplang/proposals/csharp-9.0/records.md)
263-
- [Init-only setters](~/_csharplang/proposals/csharp-9.0/init.md)
264-
- [Covariant returns](~/_csharplang/proposals/csharp-9.0/covariant-returns.md)
262+
- [Records](~/_csharpstandard/standard/classes.md#1516-synthesized-record-class-members)
263+
- [Init-only setters](~/_csharpstandard/standard/classes.md#15733-init-accessors)
264+
- [Covariant returns](~/_csharpstandard/standard/classes.md#1565-override-methods)
265265

266266
## See also
267267

docs/csharp/language-reference/compiler-messages/entry-point-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ To correct these errors, ensure the `StartupObject` option references a valid ty
124124
- **CS8805**: *Program using top-level statements must be an executable.*
125125
- **CS8937**: *At least one top-level statement must be non-empty.*
126126

127-
[Top-level statements](../../fundamentals/program-structure/top-level-statements.md) replace the explicit `Main` method as the program's entry point. For more information, see [Top-level statements](../../fundamentals/program-structure/top-level-statements.md) in the C# programming guide and the [top-level statements](~/_csharplang/proposals/csharp-9.0/top-level-statements.md) feature specification.
127+
[Top-level statements](../../fundamentals/program-structure/top-level-statements.md) replace the explicit `Main` method as the program's entry point. For more information, see [Top-level statements](../../fundamentals/program-structure/top-level-statements.md) in the C# programming guide and the [top-level statements](~/_csharpstandard/standard/basic-concepts.md#713-using-top-level-statements) section of the C# language specification.
128128

129129
To correct these errors, ensure your use of top-level statements follows these rules:
130130

docs/csharp/language-reference/compiler-messages/lambda-expression-errors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ The compiler also produces the following *informational* message:
160160
- **CS8971**: Warning: *InterpolatedStringHandlerArgument has no effect when applied to lambda parameters and will be ignored at the call site.*
161161
- **CS9236**: Informational: *Compiling requires binding the lambda expression at least count times. Consider declaring the lambda expression with explicit parameter types, or if the containing method call is generic, consider using explicit type arguments.*
162162

163-
The compiler prohibits certain C# constructs inside [lambda expressions](../operators/lambda-expressions.md) and [anonymous methods](../operators/delegate-operator.md). These restrictions exist because the compiler transforms lambdas and anonymous methods into [delegate](../../programming-guide/delegates/index.md) invocations or [expression trees](../../advanced-topics/expression-trees/index.md), and some constructs can't be represented in those forms. For more information, see the [anonymous function expressions](~/_csharpstandard/standard/expressions.md#1221-anonymous-function-expressions) section of the C# specification.
163+
The compiler prohibits certain C# constructs inside [lambda expressions](../operators/lambda-expressions.md) and [anonymous methods](../operators/delegate-operator.md). These restrictions exist because the compiler transforms lambdas and anonymous methods into [delegate](../../programming-guide/delegates/index.md) invocations or [expression trees](../../advanced-topics/expression-trees/index.md), and some constructs can't be represented in those forms. For more information, see the [anonymous function expressions](~/_csharpstandard/standard/expressions.md#1222-anonymous-function-expressions) section of the C# specification.
164164

165165
You can correct these errors by using the following guidance:
166166

@@ -197,7 +197,7 @@ You can correct these errors by using the following guidance:
197197
- **CS8975**: *The contextual keyword 'var' cannot be used as an explicit lambda return type.*
198198
- **CS9098**: *Implicitly typed lambda parameter '...' cannot have a default value.*
199199

200-
These errors indicate a problem with a [lambda expression parameter](../operators/lambda-expressions.md#input-parameters-of-a-lambda-expression) or return type declaration. For the full rules on lambda parameter and return types, see [lambda expressions](../operators/lambda-expressions.md), [anonymous methods](../operators/delegate-operator.md), and the [anonymous function expressions](~/_csharpstandard/standard/expressions.md#1221-anonymous-function-expressions) section of the C# specification.
200+
These errors indicate a problem with a [lambda expression parameter](../operators/lambda-expressions.md#input-parameters-of-a-lambda-expression) or return type declaration. For the full rules on lambda parameter and return types, see [lambda expressions](../operators/lambda-expressions.md), [anonymous methods](../operators/delegate-operator.md), and the [anonymous function expressions](~/_csharpstandard/standard/expressions.md#1222-anonymous-function-expressions) section of the C# specification.
201201

202202
> [!NOTE]
203203
> **CS1731** and **CS1732** are no longer produced by the current version of the C# compiler (Roslyn). They might appear if you're using an older compiler version.
@@ -228,7 +228,7 @@ You can correct these errors by using the following guidance:
228228
- **CS9099**: Warning: *The default parameter value does not match in the target delegate type.*
229229
- **CS9100**: Warning: *Parameter has params modifier in lambda but not in target delegate type.*
230230

231-
These errors indicate a problem with the [delegate type](../../programming-guide/delegates/index.md) that the compiler infers or expects for a [lambda expression](../operators/lambda-expressions.md), [anonymous method](../operators/delegate-operator.md), or [method group](~/_csharpstandard/standard/conversions.md#108-method-group-conversions). For the full rules on delegate conversions, see [lambda expressions](../operators/lambda-expressions.md), [anonymous methods](../operators/delegate-operator.md), and the [anonymous function expressions](~/_csharpstandard/standard/expressions.md#1221-anonymous-function-expressions) section of the C# specification.
231+
These errors indicate a problem with the [delegate type](../../programming-guide/delegates/index.md) that the compiler infers or expects for a [lambda expression](../operators/lambda-expressions.md), [anonymous method](../operators/delegate-operator.md), or [method group](~/_csharpstandard/standard/conversions.md#108-method-group-conversions). For the full rules on delegate conversions, see [lambda expressions](../operators/lambda-expressions.md), [anonymous methods](../operators/delegate-operator.md), and the [anonymous function expressions](~/_csharpstandard/standard/expressions.md#1222-anonymous-function-expressions) section of the C# specification.
232232

233233
> [!NOTE]
234234
> The current version of the C# compiler (Roslyn) doesn't produce **CS0467**. You might see this error if you're using an older compiler version.

0 commit comments

Comments
 (0)