Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Summary

Since C# 10, record struct allows records to be value types, making the statement "types defined with the record keyword are reference types" inaccurate.

Changes:

  • Line 74: Clarified struct or record struct → value types; class or record class → reference types
  • Line 127: Changed record to record class in reference type definition

Fixes #49949

Original prompt

This section details on the original issue you should resolve

<issue_title>Outdated statement about record types always being reference types</issue_title>
<issue_description>### Describe the issue or suggestion

In the [C# Fundamentals / Type System / Overview] (https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/types/#:~:text=Types%20that%20you%20define%20by%20using%20the%20class%20or%20record%20keyword%20are%20reference%20types.) the documentation says: "Types that you define by using the class or record keyword are reference types.". However, since C# 10 introduced record struct, this statement is no longer accurate.
Thanks for maintaining these excellent docs — just a small fix to keep them up to date!


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/csharp/fundamentals/types/index.md The C# type system

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix outdated statement about record types in documentation Fix outdated statement about record types always being reference types Nov 19, 2025
Copilot finished work on behalf of gewarren November 19, 2025 21:54
Copilot AI requested a review from gewarren November 19, 2025 21:54
@gewarren gewarren marked this pull request as ready for review November 19, 2025 21:56
@gewarren gewarren requested review from a team and BillWagner as code owners November 19, 2025 21:56
Copilot AI review requested due to automatic review settings November 19, 2025 21:56
Copilot finished reviewing on behalf of gewarren November 19, 2025 21:58
Copy link
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

This PR updates outdated documentation about C# record types to reflect the introduction of record struct in C# 10. Previously, the documentation incorrectly stated that all records are reference types, but record struct allows records to be value types.

Key Changes:

  • Updated line 74 to clarify that both struct and record struct create value types, while class and record class create reference types
  • Updated line 127 to specify record class instead of just record when defining reference types

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

This is fine, with one clarifying change.

@BillWagner BillWagner enabled auto-merge (squash) November 20, 2025 15:46
@BillWagner BillWagner merged commit e883caf into main Nov 20, 2025
11 checks passed
@BillWagner BillWagner deleted the copilot/fix-outdated-statement-record-types branch November 20, 2025 15:49
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.

Outdated statement about record types always being reference types

3 participants