Skip to content

Required Members in C#: update sample to .NET 11 - #2408

Open
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/80678-csharp-required-members
Open

vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/80678-csharp-required-members

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Moves the RequiredPropertiesInCSharp sample from net7.0 to net11.0 and adds the examples the updated article shows: a record with a required init-only property (Product), a SetsRequiredMembers constructor that forgets its members (Order, which keeps its intended CS8618 warning), and a Customer class used to show how System.Text.Json handles a missing or null required property, with and without RespectNullableAnnotations. Program.cs runs the new demos and a commented-out line shows the CS9040 new() constraint error; the two stale comments that named a non-existent RewrittenClass now name ClassWithRequiredProperty and error CS9035. No packages and no test project; the folder still builds with one intended warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant