C# Feature - Partial constructors
Partial constructors
Section titled “Partial constructors”Partial constructors allow one partial type declaration to declare an instance constructor while another partial declaration provides the implementation body.
Introduced In
Section titled “Introduced In”This feature was introduced in C# 14 under the broader “more partial members” work. 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”Like other partial-member features, partial constructors primarily help source generators and tooling scenarios where a generated declaration and a handwritten implementation need to cooperate.
Example
Section titled “Example”public partial class Customer{ partial Customer(int id, string name);}
public partial class Customer{ public int Id { get; } public string Name { get; }
partial Customer(int id, string name) { Id = id; Name = name; }}- A partial constructor needs exactly one defining declaration and one implementing declaration.
- Only the implementing declaration can include a constructor initializer such as
: this(...)or: base(...). - Only one partial type declaration can include primary-constructor syntax for the same type.
Common Pitfalls
Section titled “Common Pitfalls”- This is not a general-purpose readability feature for normal domain models.
- Constructor logic spread across generated and handwritten files can still become difficult to trace if used carelessly.