C# Feature - Partial events
Partial events
Section titled “Partial events”Partial events allow one partial type declaration to define an event and another partial declaration to provide the implementation.
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”Partial events are mainly useful in source-generation and framework scenarios where one part of a type is generated and another part is handwritten.
Example
Section titled “Example”public partial class OrderMonitor{ public partial event EventHandler? Changed;}
public partial class OrderMonitor{ private EventHandler? _changed;
public partial event EventHandler? Changed { add => _changed += value; remove => _changed -= value; }}- A partial event needs exactly one defining declaration and one implementing declaration.
- The defining declaration uses field-like event syntax.
- The implementing declaration must provide
addandremoveaccessors.
Common Pitfalls
Section titled “Common Pitfalls”- This is a specialized feature; it is rarely needed in typical line-of-business application code.
- Keep generator-produced and handwritten event declarations synchronized exactly.