Skip to content

Add fundamentals coverage for C# 15 closed hierarchies - #56517

Open
SkyDevLab wants to merge 1 commit into
dotnet:mainfrom
SkyDevLab:docs/54014-closed-hierarchies
Open

SkyDevLab wants to merge 1 commit into
dotnet:mainfrom
SkyDevLab:docs/54014-closed-hierarchies

Conversation

@SkyDevLab

@SkyDevLab SkyDevLab commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Adds C# 15 (.NET 11) fundamentals coverage for closed hierarchies across classes, records, type patterns, and the type system overview.

Fixes #54014


Internal previews

File Preview link
docs/csharp/fundamentals/patterns/type-patterns.md Learn preview
docs/csharp/fundamentals/types/classes.md Learn preview
docs/csharp/fundamentals/types/index.md Learn preview
docs/csharp/fundamentals/types/records.md Learn preview

Build report

@SkyDevLab
SkyDevLab requested review from a team and BillWagner as code owners October 21, 2026 17:58
@dotnetrepoman dotnetrepoman Bot added this to the October 2026 milestone Oct 21, 2026
@dotnet-policy-service dotnet-policy-service Bot added dotnet-csharp/svc fundamentals/subsvc community-contribution Indicates PR is created by someone from the .NET community. labels Oct 21, 2026
@BillWagner
BillWagner requested a balanced review from Copilot October 22, 2026 14:16
@BillWagner

Copy link
Copy Markdown
Member

Hi @SkyDevLab

I'm going to hold this for now. I had planned on this for November because the Fundamentals section is tailored for developers new to C#. A very small slice of those readers download the preview releases (including the RC builds).

I'll plan on merging and publishing around the GA release for .NET 11.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new shape-matching example accesses properties that its classes don't define, causing compilation errors.

1 open issue
What changed in this PR

Adds C# 15 (.NET 11) closed-hierarchy coverage to the fundamentals documentation, addressing #54014 across classes, records, type selection, and pattern matching.

Changes:

  • Explains closed class and record hierarchies and compares them with union types.
  • Adds examples of exhaustive pattern matching over closed hierarchies.
  • Updates the type-system overview with closed-hierarchy guidance.
File Description
docs/​csharp/​fundamentals/​types/​records.md Adds closed record hierarchy and result-matching examples.
docs/​csharp/​fundamentals/​types/​index.md Adds closed hierarchies to class and type-selection guidance.
docs/​csharp/​fundamentals/​types/​classes.md Explains closed classes with a payment-method example.
docs/​csharp/​fundamentals/​patterns/​type-patterns.md Adds exhaustive shape matching and subtype-change guidance.

Review effort: Balanced

Comment on lines +53 to +54
public class Circle(double Radius) : Shape;
public class Rectangle(double Width, double Height) : Shape;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc fundamentals/subsvc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C# 15-Fundamentals]: New Feature - Closed hierarchies

3 participants