Skip to content

Tutorial: Choosing between tuples, records, structs, and classes#53160

Draft
BillWagner wants to merge 5 commits intodotnet:mainfrom
BillWagner:every-csharp-choosing-types
Draft

Tutorial: Choosing between tuples, records, structs, and classes#53160
BillWagner wants to merge 5 commits intodotnet:mainfrom
BillWagner:every-csharp-choosing-types

Conversation

@BillWagner
Copy link
Copy Markdown
Member

@BillWagner BillWagner commented Apr 15, 2026

Fixes #51996

This pull request introduces a new tutorial to the C# Fundamentals documentation that helps developers choose between tuples, records, structs, classes, and interfaces by walking through a practical coffee shop example. It includes a comprehensive, example-driven guide, a complete code sample, and updates the table of contents to surface the new material.

New tutorial and code sample:

  • Added a detailed tutorial, choosing-types.md, that explains when to use tuples, record classes, record structs, classes, and interfaces, with practical examples and a decision guide table.
  • Introduced a full runnable code sample in snippets/choosing-types/Program.cs that demonstrates each type in context, including tuples, records, structs, classes, and interfaces.

Documentation navigation:

  • Updated the table of contents (toc.yml) to add the new tutorial under the Fundamentals section for easier discovery.

Internal previews

📄 File 🔗 Preview link
docs/csharp/fundamentals/tutorials/choosing-types.md Tutorial: Choose between tuples, records, structs, and classes
docs/csharp/toc.yml Taken from https://github.com/dotnet/roslyn/wiki/Samples-and-Walkthroughs

Add an example of an inheritance scenario in this tutorial.
Discuss how you can change these decisions over time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Everyday C#] Phase B, Task 7. Tutorial - Choosing between tuples, structs, records, and classes

1 participant