diff --git a/docs/csharp/language-reference/builtin-types/ref-struct.md b/docs/csharp/language-reference/builtin-types/ref-struct.md index b96e32cc2c31b..1b4007e9a8023 100644 --- a/docs/csharp/language-reference/builtin-types/ref-struct.md +++ b/docs/csharp/language-reference/builtin-types/ref-struct.md @@ -1,7 +1,7 @@ --- title: "ref struct types" description: Learn about the ref struct type in C# -ms.date: 07/26/2024 +ms.date: 01/27/2025 --- # `ref` structure types (C# reference) @@ -66,15 +66,15 @@ Beginning with C# 13, you can also implement the [!IMPORTANT] > A `ref struct` that implements an interface includes the potential for later source-breaking and binary-breaking changes. The break occurs if a `ref struct` implements an interface defined in another assembly, and that assembly provides an update which adds default members to that interface. > -> The source-break happens when you recompile the `ref struct`: It must implement the new member, even though there is a default implementation. +> The source-break happens when you recompile the `ref struct`: It must implement the new member, even though there's a default implementation. > > The binary-break happens if you upgrade the external assembly without recompiling the `ref struct` type *and* the updated code calls the default implementation of the new method. The runtime throws an exception when the default member is accessed. diff --git a/docs/csharp/whats-new/csharp-13.md b/docs/csharp/whats-new/csharp-13.md index 008f6788b724a..8c0dedc8d60ed 100644 --- a/docs/csharp/whats-new/csharp-13.md +++ b/docs/csharp/whats-new/csharp-13.md @@ -1,7 +1,7 @@ --- title: What's new in C# 13 description: Get an overview of the new features in C# 13. -ms.date: 09/30/2024 +ms.date: 01/27/2025 ms.topic: whats-new --- # What's new in C# 13 @@ -136,9 +136,9 @@ This enables types such as a ## `ref struct` interfaces -Before C# 13, `ref struct` types weren't allowed to implement interfaces. Beginning with C# 13, they can. You can declare that a `ref struct` type implements an interface. However, to ensure ref safety rules, a `ref struct` type can't be converted to an interface type. That conversion is a boxing conversion, and could violate ref safety. From that rule, `ref struct` types can't declare methods that explicitly implement an interface method. Also, `ref struct` types must implement all methods declared in an interface, including those methods with a default implementation. +Before C# 13, `ref struct` types weren't allowed to implement interfaces. Beginning with C# 13, they can. You can declare that a `ref struct` type implements an interface. However, to ensure ref safety rules, a `ref struct` type can't be converted to an interface type. That conversion is a boxing conversion, and could violate ref safety. Explicit interface method declarations in a `ref struct` can be accessed only through a type parameter where that type parameter [`allows ref struct`](../programming-guide/generics/constraints-on-type-parameters.md#allows-ref-struct). Also, `ref struct` types must implement all methods declared in an interface, including those methods with a default implementation. -Learn more in the updates on [`ref struct` types](../language-reference/builtin-types/ref-struct.md#restrictions-for-ref-struct-types-that-implement-an-interface). +Learn more in the updates on [`ref struct` types](../language-reference/builtin-types/ref-struct.md#restrictions-for-ref-struct-types-that-implement-an-interface) and the addition of the [`allows ref struct`](../programming-guide/generics/constraints-on-type-parameters.md#allows-ref-struct) generic constraint. ## More partial members @@ -175,7 +175,7 @@ This feature is intended for library authors to avoid ambiguity when adding new The [`field`](../language-reference/keywords/field.md) contextual keyword is in C# 13 as a preview feature. The token `field` accesses the compiler synthesized backing field in a property accessor. It enables you to write an accessor body without declaring an explicit backing field in your type declaration. You can declare a body for one or both accessors for a field backed property. -The `field` feature is released as a preview feature. We want to learn from your experiences using it. There's a potential a breaking change or confusion reading code in types that also include a field named `field`. You can use `@field` or `this.field` to disambiguate between the `field` keyword and the identifier. +The `field` feature is released as a preview feature. We want to learn from your experiences using it. There's a potential breaking change or confusion reading code in types that also include a field named `field`. You can use `@field` or `this.field` to disambiguate between the `field` keyword and the identifier. [!INCLUDE[field-preview](../includes/field-preview.md)]