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.