Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positional parameters in records can create fields instead of properties #44041

Closed
BillWagner opened this issue Dec 19, 2024 · 0 comments · Fixed by #44691
Closed

Positional parameters in records can create fields instead of properties #44041

BillWagner opened this issue Dec 19, 2024 · 0 comments · Fixed by #44691
Assignees
Labels
dotnet-csharp/svc in-pr This issue will be closed (fixed) by an active pull request. lang-reference/subsvc okr-freshness OKR: Freshness of content 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@BillWagner
Copy link
Member

BillWagner commented Dec 19, 2024

Type of issue

Missing information

Description

These declarations are both legal:

public record class C(int X)
{
    public int X = X; // effectively this.X = X
}

public record struct S(int X)
{
    public int X = X; // effectively this.X = X
}

This article only talks about "properties", which is the default for a record's primary constructor parameter. It should include how to create a public field as well.

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/record

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/builtin-types/record.md

Document Version Independent Id

de1f383b-ef20-4776-57a8-04edae892166

Article author

@BillWagner

Metadata

  • ID: 20818c64-4ad8-fb15-5d79-e7f98614e9c4
  • Service: dotnet-csharp
  • Sub-service: lang-reference

Related Issues


Associated WorkItem - 370944

@dotnetrepoman dotnetrepoman bot added the ⌚ Not Triaged Not triaged label Dec 19, 2024
@BillWagner BillWagner self-assigned this Jan 6, 2025
@BillWagner BillWagner added Pri1 and removed ⌚ Not Triaged Not triaged labels Jan 6, 2025
@dotnetrepoman dotnetrepoman bot added the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Jan 6, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Jan 6, 2025
@BillWagner BillWagner removed the Pri1 label Jan 22, 2025
@dotnetrepoman dotnetrepoman bot added the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Feb 3, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Feb 3, 2025
@dotnetrepoman dotnetrepoman bot added the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Feb 5, 2025
@BillWagner BillWagner moved this from 🔖 Ready to 🏗 In progress in dotnet/docs February 2025 sprint project Feb 5, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Feb 5, 2025
@BillWagner BillWagner moved this from 🏗 In progress to 👀 In review in dotnet/docs February 2025 sprint project Feb 5, 2025
@dotnetrepoman dotnetrepoman bot added the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Feb 5, 2025
@dotnet-policy-service dotnet-policy-service bot added in-pr This issue will be closed (fixed) by an active pull request. and removed 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. labels Feb 5, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in dotnet/docs February 2025 sprint project Feb 5, 2025
@BillWagner BillWagner added 🗺️ reQUEST Triggers an issue to be imported into Quest. okr-freshness OKR: Freshness of content and removed resolved-by-customer labels Feb 6, 2025
@sequestor sequestor bot removed the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Feb 7, 2025
@sequestor sequestor bot added the 📌 seQUESTered Identifies that an issue has been imported into Quest. label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-csharp/svc in-pr This issue will be closed (fixed) by an active pull request. lang-reference/subsvc okr-freshness OKR: Freshness of content 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants