Skip to content

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

Open
BillWagner wants to merge 7 commits intodotnet:mainfrom
BillWagner:every-csharp-choosing-types
Open

Tutorial: Choosing between tuples, records, structs, and classes#53160
BillWagner wants to merge 7 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

@dotnetrepoman dotnetrepoman Bot added this to the April 2026 milestone Apr 15, 2026
@BillWagner BillWagner force-pushed the every-csharp-choosing-types branch 2 times, most recently from 43953a4 to af46fbb Compare April 29, 2026 21:20
@BillWagner BillWagner marked this pull request as ready for review April 29, 2026 21:24
@BillWagner BillWagner requested a review from a team as a code owner April 29, 2026 21:24
Copilot AI review requested due to automatic review settings April 29, 2026 21:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new C# Fundamentals tutorial that helps learners choose between tuples, record classes, record structs, classes, and interfaces using a coffee shop–based walkthrough, and surfaces the tutorial in the C# table of contents.

Changes:

  • Added a new tutorial page (choosing-types.md) with scenario-driven guidance and a quick decision table.
  • Added a runnable sample (snippets/choosing-types/Program.cs) that demonstrates tuples, records, structs, classes, inheritance, and interfaces.
  • Updated docs/csharp/toc.yml to include the new tutorial under Fundamentals tutorials.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
docs/csharp/toc.yml Adds a TOC entry so the new tutorial is discoverable under Fundamentals tutorials.
docs/csharp/fundamentals/tutorials/choosing-types.md Introduces the new tutorial content and references snippet regions for examples.
docs/csharp/fundamentals/tutorials/snippets/choosing-types/Program.cs Provides the example code regions used throughout the tutorial.

Comment thread docs/csharp/fundamentals/tutorials/choosing-types.md Outdated
Comment thread docs/csharp/fundamentals/tutorials/choosing-types.md Outdated
Add an example of an inheritance scenario in this tutorial.
Discuss how you can change these decisions over time.
Restructures this article to provide a better context and motivations.
Make sure the template was applied correctly and do a final copy edit.
@BillWagner BillWagner force-pushed the every-csharp-choosing-types branch from af46fbb to a65bf4c Compare April 30, 2026 14:12
@BillWagner BillWagner requested a review from adegeo April 30, 2026 15:08
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

2 participants