C# Feature - Partial properties
Partial properties
Section titled โPartial propertiesโPartial properties allow a property declaration and its implementation to live in different parts of the same partial type.
Introduced In
Section titled โIntroduced InโThis feature was introduced in C# 13.0 (2024).
Why This Feature Exists
Section titled โWhy This Feature ExistsโThis feature is mainly useful in source-generation and code-generation scenarios, where one file declares the shape of a type and another file supplies the implementation. It reduces boilerplate in generated partial types while keeping declarations and implementations aligned.
When To Use It
Section titled โWhen To Use Itโ- Use it in generated-code scenarios where declarations and implementations are intentionally separated.
- Use it in large partial types where generated and handwritten code must coexist cleanly.
- Avoid it in ordinary application code unless the split is genuinely helpful.
public partial class CustomerViewModel{ private string _name = "";
public string Name { get => _name; set => _name = value; }}public partial class CustomerViewModel{ public partial string Name { get; set; }}
public partial class CustomerViewModel{ private string _name = "";
public partial string Name { get => _name; set => _name = value; }}Practical Use Case
Section titled โPractical Use CaseโOne common scenario is a generated partial type that declares bindable or tracked members, while a handwritten partial file defines validation or storage rules.
Common Pitfalls
Section titled โCommon Pitfallsโ- This is not a general readability improvement for most codebases.
- Keep declaration and implementation naming perfectly synchronized.
- Use it sparingly; partial members are easiest to justify in tooling or generated-code workflows.
Version Notes
Section titled โVersion Notesโ- C# 13 added partial properties as part of broader partial member enhancements.