From a37698dd689073f00eca5c5bbdf405fad43965c7 Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Sat, 24 Jan 2026 11:08:26 -0500 Subject: [PATCH 1/2] support record with sealed ToString --- standard/classes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/standard/classes.md b/standard/classes.md index b4b75ec21..1ae995942 100644 --- a/standard/classes.md +++ b/standard/classes.md @@ -6245,7 +6245,9 @@ The record class shall include a synthesized method equivalent to a method decla public override string ToString(); ``` -The method may be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or if the explicit declaration doesn't allow overriding it in a derived type and the record class type is not sealed. It is an error if either synthesized, or explicitly declared, method doesn't override `object.ToString()` (for example, due to shadowing in intermediate base types). +The method may be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility. It is an error if either synthesized, or explicitly declared, method doesn't override `object.ToString()` (for example, due to shadowing in intermediate base types). + +Sealing an explicitly declared `ToString` method prevents the compiler from synthesizing a `ToString` method for any derived record types. However, this does not prevent the compiler from synthesizing `PrintMembers`. The synthesized method: From 6d786ac22afcd57fa7c8fa80b6b09176bd6c20a4 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 10 Feb 2026 15:22:31 -0500 Subject: [PATCH 2/2] Clean up blank lines in classes.md Remove unnecessary blank lines from classes.md --- standard/classes.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/standard/classes.md b/standard/classes.md index 1ae995942..fe42feab7 100644 --- a/standard/classes.md +++ b/standard/classes.md @@ -6485,6 +6485,3 @@ A positional record class ([ยง15.2.1](classes.md#1521-general)) with at least on > ``` > > *end example* - - -