Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .openpublishing.publish.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"path_to_root": "_csharpstandard",
"url": "https://github.com/dotnet/csharpstandard",
"branch": "v11-alpha",
"branch": "alpha-v12",
"include_in_build": true,
"branch_mapping": {}
},
Expand Down
19 changes: 1 addition & 18 deletions docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
},
{
"files": [
"csharp-12.0/*.md",
"csharp-13.0/*.md",
"csharp-14.0/*.md",
"csharp-15.0/*.md",
Expand Down Expand Up @@ -503,8 +502,7 @@
"docs/visual-basic/**/**.{md,yml}": "wiwagn"
},
"ms.date": {
"_csharpstandard/standard/*.md": "09/12/2025",
"_csharplang/proposals/csharp-12.0/*.md": "08/15/2023",
"_csharpstandard/standard/*.md": "08/12/2026",
"_csharplang/proposals/csharp-13.0/*.md": "10/31/2024",
"_csharplang/proposals/csharp-14.0/*.md": "08/06/2025",
"_csharplang/proposals/csharp-15.0/*.md": "08/12/2026",
Expand Down Expand Up @@ -617,13 +615,6 @@
"_csharpstandard/standard/standard-library.md": "Standard library",
"_csharpstandard/standard/documentation-comments.md": "Documentation comments",
"_csharpstandard/standard/Bibliography.md": "Bibliography",
"_csharplang/proposals/csharp-12.0/primary-constructors.md": "Primary constructors",
"_csharplang/proposals/csharp-12.0/using-alias-types.md": "Alias any type",
"_csharplang/proposals/csharp-12.0/lambda-method-group-defaults.md": "Optional and parameter array parameters for lambdas and method groups",
"_csharplang/proposals/csharp-12.0/inline-arrays.md": "Inline arrays, or fixed sized buffers",
"_csharplang/proposals/csharp-12.0/collection-expressions.md": "Collection expressions",
"_csharplang/proposals/csharp-12.0/experimental-attribute.md": "Experimental attribute",
"_csharplang/proposals/csharp-12.0/ref-readonly-parameters.md": "Ref readonly parameters",
"_csharplang/proposals/csharp-13.0/collection-expressions-better-conversion.md": "Better conversion from collection expression",
"_csharplang/proposals/csharp-13.0/esc-escape-sequence.md": "String/Character escape sequence '\\e'",
"_csharplang/proposals/csharp-13.0/lock-object.md": "Obey lock object semantics for lock statements",
Expand Down Expand Up @@ -704,13 +695,6 @@
"_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.",
"_csharpstandard/standard/documentation-comments.md": "This appendix describes XML comments that are used to document your program.",
"_csharpstandard/standard/Bibliography.md": "This appendix lists external standards referenced in this specification.",
"_csharplang/proposals/csharp-12.0/primary-constructors.md": "Primary constructors put the parameters of one constructor in scope for the whole class or struct to be used for initialization or directly as object state. The trade-off is that any other constructors must call through the primary constructor.",
"_csharplang/proposals/csharp-12.0/using-alias-types.md": "Using directives can alias any type, not just named types. You can create aliases for tuple types, generics and more.",
"_csharplang/proposals/csharp-12.0/lambda-method-group-defaults.md": "Optional and parameter array parameters for lambdas and method groups",
"_csharplang/proposals/csharp-12.0/inline-arrays.md": "Inline arrays provide a general-purpose and safe mechanism for declaring inline arrays within C# classes, structs, and interfaces.",
"_csharplang/proposals/csharp-12.0/collection-expressions.md": "Collection expressions provide a concise syntax to initialize collections by defining elements or embedded collections as the source of the new collection's elements.",
"_csharplang/proposals/csharp-12.0/experimental-attribute.md": "Use the ExperimentalAttribute attribute to indicate APIs that aren't stable.",
"_csharplang/proposals/csharp-12.0/ref-readonly-parameters.md": "Ref readonly parameters enforce that arguments are passed by references, where `in` parameters allow the compiler some flexibiility.",
"_csharplang/proposals/csharp-13.0/collection-expressions-better-conversion.md": "Conversions from collection expressions match the element type before matching the collection type.",
"_csharplang/proposals/csharp-13.0/esc-escape-sequence.md" : "The sequence '\\e' is now interpreted as the 'ESC' character, character point '0x1b'",
"_csharplang/proposals/csharp-13.0/lock-object.md": "Special-case how `System.Threading.Lock` interacts with the `lock` keyword by calling its `EnterScope` method. Add static analysis warnings to prevent accidental misuse of the type where possible.",
Expand Down Expand Up @@ -760,7 +744,6 @@
"titleSuffix": {
"docs/**/*.{md,yml}": ".NET",
"_csharpstandard/standard/*.md": "C# language specification",
"_csharplang/proposals/csharp-12.0/*.md": "C# feature specifications",
"_csharplang/proposals/csharp-13.0/*.md": "C# feature specifications",
"_csharplang/proposals/csharp-14.0/*.md": "C# feature specifications",
"_csharplang/proposals/csharp-15.0/*.md": "C# feature specifications",
Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/attributes/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Beginning in C# 12, types, methods, and assemblies can be marked with the <xref:
> [!WARNING]
> Experimental features are subject to changes. The APIs can change, or they can be removed in future updates. Including experimental features is a way for library authors to get feedback on ideas and concepts for future development. Use extreme caution when using any feature marked as experimental. You can learn more about how APIs are marked as experimental in our article on [preview APIs](../../../fundamentals/runtime-libraries/preview-apis.md#experimentalattribute).

You can read more details about the `Experimental` attribute in the [feature specification](~/_csharplang/proposals/csharp-12.0/experimental-attribute.md).
You can read more details about the `Experimental` attribute in the [feature specification](https://github.com/dotnet/csharplang/blob/main/proposals/csharp-12.0/experimental-attribute.md).

The Windows Foundation Metadata libraries use the <xref:Windows.Foundation.Metadata.ExperimentalAttribute?displayProperty=nameWithType>, which predates C# 12.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ For more information, see the following sections of the [C# language specificati

- [Default values](~/_csharpstandard/standard/variables.md#93-default-values)
- [Default constructors](~/_csharpstandard/standard/types.md#833-default-constructors)
- [Parameterless struct constructors](~/_csharpstandard/standard/structs.md#1669-constructors)
- [Auto default structs](~/_csharpstandard/standard/structs.md#16681-field-initializers)
- [Parameterless struct constructors](~/_csharpstandard/standard/structs.md#1689-constructors)
- [Auto default structs](~/_csharpstandard/standard/structs.md#16881-field-initializers)

## See also

Expand Down
4 changes: 2 additions & 2 deletions docs/csharp/language-reference/builtin-types/ref-struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ The compiler enforces these restrictions. If you write `ref struct` types that i
For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md):

- [Structs: Ref modifier](~/_csharpstandard/standard/structs.md#1623-ref-modifier)
- [Safe context constraint for ref struct types](~/_csharpstandard/standard/structs.md#16615-safe-context-constraint)
- [Safe context constraint for ref struct types](~/_csharpstandard/standard/structs.md#16815-safe-context-constraint)

For more information about `ref` fields, see [Ref fields](~/_csharpstandard/standard/structs.md#16682-ref-fields) in the C# language specification.
For more information about `ref` fields, see [Ref fields](~/_csharpstandard/standard/structs.md#16882-ref-fields) in the C# language specification.

## See also

Expand Down
10 changes: 5 additions & 5 deletions docs/csharp/language-reference/builtin-types/struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ But it can be any reference type, or any value type:

You can use inline arrays with almost any C# data structure.

Inline arrays are an advanced language feature. They're intended for high-performance scenarios where an inline, contiguous block of elements is faster than other alternative data structures. You can learn more about inline arrays from the [feature spec](~/_csharplang/proposals/csharp-12.0/inline-arrays.md).
Inline arrays are an advanced language feature. They're intended for high-performance scenarios where an inline, contiguous block of elements is faster than other alternative data structures. You can learn more about inline arrays from [§16.6 Inline arrays](~/_csharpstandard/standard/structs.md#166-inline-arrays) in the C# standard.

## Struct initialization and default values

Expand All @@ -140,7 +140,7 @@ If you don't initialize all fields in a struct, the compiler adds code to the co

:::code language="csharp" source="snippets/shared/StructType.cs" id="FieldInitializer":::

Every `struct` has a `public` parameterless constructor. If you write a parameterless constructor, it must be public. If a struct declares any field initializers, it must explicitly declare a constructor. That constructor need not be parameterless. If a struct declares a field initializer but no constructors, the compiler reports an error. Any explicitly declared constructor (with parameters, or parameterless) executes all field initializers for that struct. All fields without a field initializer or an assignment in a constructor are set to the [default value](default-values.md). For more information, see the [C# language specification—Constructors](~/_csharpstandard/standard/structs.md#1669-constructors).
Every `struct` has a `public` parameterless constructor. If you write a parameterless constructor, it must be public. If a struct declares any field initializers, it must explicitly declare a constructor. That constructor need not be parameterless. If a struct declares a field initializer but no constructors, the compiler reports an error. Any explicitly declared constructor (with parameters, or parameterless) executes all field initializers for that struct. All fields without a field initializer or an assignment in a constructor are set to the [default value](default-values.md). For more information, see the [C# language specification—Constructors](~/_csharpstandard/standard/structs.md#1689-constructors).

Beginning with C# 12, `struct` types can define a [primary constructor](../../programming-guide/classes-and-structs/instance-constructors.md#primary-constructors) as part of its declaration. Primary constructors provide a concise syntax for constructor parameters that can be used throughout the `struct` body, in any member declaration for that struct.

Expand Down Expand Up @@ -176,11 +176,11 @@ For more information, see the [Structs](~/_csharpstandard/standard/structs.md) s

- [Readonly structs](~/_csharpstandard/standard/structs.md#1622-struct-modifiers)
- [Readonly instance members](~/_csharpstandard/standard/structs.md#163-struct-members)
- [Parameterless struct constructors](~/_csharpstandard/standard/structs.md#1669-constructors)
- [Parameterless struct constructors](~/_csharpstandard/standard/structs.md#1689-constructors)
- [Allow `with` expression on structs](~/_csharpstandard/standard/expressions.md#1210-with-expressions)
- [Record structs](~/_csharpstandard/standard/structs.md#164-record-structs)
- [Record structs](~/_csharpstandard/standard/structs.md#165-record-structs)

You can also read about [Auto default structs](~/_csharpstandard/standard/structs.md#16681-field-initializers) in the C# language specification.
You can also read about [Auto default structs](~/_csharpstandard/standard/structs.md#16881-field-initializers) in the C# language specification.

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ To correct these errors:
- Remove the `unscoped` modifier or the <xref:System.Diagnostics.CodeAnalysis.UnscopedRefAttribute?displayProperty=nameWithType> attribute from struct constructors and init-only members. These members have special initialization semantics where the compiler must ensure that any references don't outlive the initialization phase, and allowing unscoped references would violate the guarantee that initialization completes before the struct becomes fully accessible (**CS9101**).
- Remove the `unscoped` modifier from interface implementation methods when the corresponding interface method doesn't have it. The unscoped characteristic affects the method's contract regarding reference lifetime guarantees, and implementations must maintain the same contract as the interface they're implementing to ensure callers can rely on consistent lifetime behavior regardless of which implementation is invoked (**CS9102**).

For more information about scoped and unscoped references, see [Method parameters](../keywords/method-parameters.md) and [Safe context constraint](~/_csharpstandard/standard/structs.md#16615-safe-context-constraint) in the C# language specification.
For more information about scoped and unscoped references, see [Method parameters](../keywords/method-parameters.md) and [Safe context constraint](~/_csharpstandard/standard/structs.md#16815-safe-context-constraint) in the C# language specification.

## Reference variables require a referent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ The following example shows how to define a `using` directive and a `using` alia

:::code language="csharp" source="./snippets/csrefKeywordsNamespace2.cs" id="Snippet9":::

Beginning with C# 12, you can create aliases for types that were previously restricted, including [tuple types](../builtin-types/value-tuples.md#tuple-field-names), pointer types, and other unsafe types. For more information on the updated rules, see the [feature spec](~/_csharplang/proposals/csharp-12.0/using-alias-types.md).
Beginning with C# 12, you can create aliases for types that were previously restricted, including [tuple types](../builtin-types/value-tuples.md#tuple-field-names), pointer types, and other unsafe types. For more information on the updated rules, see [§14.6.2 Using alias directives](~/_csharpstandard/standard/namespaces.md#1462-using-alias-directives) in the C# standard.

## Qualified alias member

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ You can convert a *collection expression* to different collection types, includi
>
> This behavior is distinct from LINQ, where a sequence might not be instantiated until it is enumerated. You can't use collection expressions to generate an infinite sequence that won't be enumerated.

The compiler uses static analysis to determine the most performant way to create the collection declared with a collection expression. For example, the empty collection expression, `[]`, can be realized as <xref:System.Array.Empty``1?displayProperty=nameWithType> if the target won't be modified after initialization. When the target is a <xref:System.Span`1?displayProperty=nameWithType> or <xref:System.ReadOnlySpan`1?displayProperty=nameWithType>, the storage might be stack allocated. The [collection expressions feature specification](~/_csharplang/proposals/csharp-12.0/collection-expressions.md) specifies the rules the compiler must follow.
The compiler uses static analysis to determine the most performant way to create the collection declared with a collection expression. For example, the empty collection expression, `[]`, can be realized as <xref:System.Array.Empty``1?displayProperty=nameWithType> if the target won't be modified after initialization. When the target is a <xref:System.Span`1?displayProperty=nameWithType> or <xref:System.ReadOnlySpan`1?displayProperty=nameWithType>, the storage might be stack allocated. The [§12.8.25 Collection expressions](~/_csharpstandard/standard/expressions.md#12825-collection-expressions) clause of the C# standard specifies the rules the compiler must follow.

Many APIs are overloaded with multiple collection types as parameters. Because a collection expression can be converted to many different expression types, these APIs might require casts on the collection expression to specify the correct conversion. The following conversion rules resolve some of the ambiguities:

- A better element conversion is preferred over a better collection type conversion. In other words, the type of elements in the collection expression has more importance than the type of the collection. These rules are described in the feature spec for [better conversion from collection expression](~/_csharplang/proposals/csharp-13.0/collection-expressions-better-conversion.md).
- Conversion to <xref:System.Span`1>, <xref:System.ReadOnlySpan`1>, or another [`ref struct`](../builtin-types/ref-struct.md) type is better than a conversion to a non-ref struct type.
- Conversion to a noninterface type is better than a conversion to an interface type.

When you convert a collection expression to a `Span` or `ReadOnlySpan`, the span object's *safe context* comes from the *safe context* of all elements included in the span. For detailed rules, see the [Collection expression specification](~/_csharplang/proposals/csharp-12.0/collection-expressions.md#ref-safety).
When you convert a collection expression to a `Span` or `ReadOnlySpan`, the span object's *safe context* comes from the *safe context* of all elements included in the span. For detailed rules, see [§9.7.2 Ref safe contexts](~/_csharpstandard/standard/variables.md#972-ref-safe-contexts) in the C# standard.

## Collection builder

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public virtual bool Equals(T? other);

For more information, see the [Relational and type-testing operators](~/_csharpstandard/standard/expressions.md#1215-relational-and-type-testing-operators) section of the [C# language specification](~/_csharpstandard/standard/README.md).

For more information about equality of record types, see the [Equality members](~/_csharpstandard/standard/classes.md#151663-equality-members) section of the [C# language specification](~/_csharpstandard/standard/README.md).
For more information about equality of record types, see the [Equality members](~/_csharpstandard/standard/classes.md#151643-equality-members) section of the [C# language specification](~/_csharpstandard/standard/README.md).

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Lambda expressions with default parameters or `params` collections as parameters

Or, you can use implicitly typed variables with `var` declarations to define the delegate type. The compiler synthesizes the correct delegate type.

For more information about default parameters on lambda expressions, see the feature spec for [default parameters on lambda expressions](~/_csharplang/proposals/csharp-12.0/lambda-method-group-defaults.md).
For more information about default parameters on lambda expressions, see the [default parameters on lambda expressions](https://github.com/dotnet/csharplang/blob/main/proposals/csharp-12.0/lambda-method-group-defaults.md) feature specification.

## Async lambdas

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You can't customize the copy semantics for structure types.
For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md):

- [`with` expression](~/_csharpstandard/standard/expressions.md#1210-with-expressions)
- [Copy and Clone members](~/_csharpstandard/standard/classes.md#151664-copy-and-clone-members)
- [Copy and Clone members](~/_csharpstandard/standard/classes.md#151644-copy-and-clone-members)

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ If the type includes the `record` modifier, the compiler instead synthesizes a p
- [Finalizers](finalizers.md)
- [base](../../language-reference/keywords/base.md)
- [this](../../language-reference/keywords/this.md)
- [Primary constructors feature spec](~/_csharplang/proposals/csharp-12.0/primary-constructors.md)
- [Primary constructors (§15.11.6)](~/_csharpstandard/standard/classes.md#15116-primary-constructors)
Loading
Loading