Skip to content

C# Feature - Partial properties

Partial properties allow a property declaration and its implementation to live in different parts of the same partial type.

This feature was introduced in C# 13.0 (2024).

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.

  • 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;
}
}

One common scenario is a generated partial type that declares bindable or tracked members, while a handwritten partial file defines validation or storage rules.

  • 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.
  • C# 13 added partial properties as part of broader partial member enhancements.