csharplang icon indicating copy to clipboard operation
csharplang copied to clipboard

[Proposal]: Partial events and constructors (VS 18.0, .NET 10)

Open jjonescz opened this issue 1 year ago • 0 comments

Partial events and constructors

  • Specification: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-14.0/partial-events-and-constructors.md
  • Discussion: https://github.com/dotnet/csharplang/discussions/8064

Summary

Allow the partial modifier on events and constructors to separate declaration and implementation parts, similar to partial methods and partial properties/indexers.

partial class C
{
    partial C(int x, string y);
    partial event Action<int, string> MyEvent;
}

partial class C
{
    partial C(int x, string y) { }
    partial event Action<int, string> MyEvent
    {
        add { }
        remove { }
    }
}

Design meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-11-02.md#partial-properties https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-01-22.md#partial-events-and-constructors

jjonescz avatar Jan 15 '25 14:01 jjonescz