docs icon indicating copy to clipboard operation
docs copied to clipboard

[C# 13]: New Feature - `field` backed properties (preview feature)

Open BillWagner opened this issue 1 year ago • 0 comments

Visual Studio release

Other (please put exact version in description textbox)

Link to speclet

Link to Pull request

New behavior

Added in VS 17.12p3

Extend all properties to allow them to reference an automatically generated backing field using the new contextual keyword field. Properties may now also contain an accessor without a body alongside an accessor with a body.

Areas affected

  • [X] Add to What's new in C# 13: Add links to updated docs in the What's new in C# 13 article.
  • [X] Update language reference: Detail the areas in the language reference that will be updated for this feature.
  • [X] Update compiler messages: Add new (or updated) pages for new compiler messages. Include related message.
  • [X] Include in Everyday C# section*: Is this new feature included in Everyday C#?
  • [X] Tutorials: Are new tutorials required for this feature? If so, detail below

Language reference tasks

Property syntax changes. This smooths the migration from auto implemented properties to properties where a field is hand-written.

It's especially useful for default implementations in interfaces, and partial properties.

Note that this is a preview feature, so when the first .NET 10 / C# 14 preview comes out, this content should reflect that.

Tutorial tasks

It's worth updating property tutorials to discuss the "grow up" and migration story from auto properties to field backed properties to fully bespoke properties.

Everyday C# tasks

The grow up story should be discussed here as well.


Associated WorkItem - 321201

BillWagner avatar Oct 03 '24 15:10 BillWagner