C# Feature - field-backed properties
field-backed properties
Section titled “field-backed properties”The contextual keyword field lets a property accessor body refer to a compiler-synthesized backing field directly.
Introduced In
Section titled “Introduced In”This feature was introduced in C# 14. The official Microsoft Learn page for C# 14 is dated November 18, 2025 and states that C# 14 ships with .NET 10 and Visual Studio 2026.
Why This Feature Exists
Section titled “Why This Feature Exists”Property validation and normalization often required dropping from an auto-property to a manually declared backing field. C# 14 preserves the convenience of an auto-property while still allowing logic inside the accessor.
Before
Section titled “Before”private string _message = "";
public string Message{ get => _message; set => _message = value ?? throw new ArgumentNullException(nameof(value));}public string Message{ get; set => field = value ?? throw new ArgumentNullException(nameof(value));}When To Use It
Section titled “When To Use It”- Use it when an auto-property needs lightweight validation or normalization.
- Use it to avoid boilerplate backing fields for simple property logic.
Common Pitfalls
Section titled “Common Pitfalls”- In a type that already has a member named
field, the new keyword can be ambiguous. Use@fieldorthis.fieldto disambiguate existing identifiers. - This is still property logic, not a replacement for complex invariants or domain validation.