IssueRaiser

[Proposal]: Partial properties (VS 17.11, .NET 9)

# Partial properties * [x] Proposed * [ ] Prototype: N/A * [ ] Implementation: [features/partial-properties](https://github.com/dotnet/roslyn/features/partial-properties) * [ ] Specification: [partial-properties.md](https://github.com/dotnet/csharplang/blob/main/proposals/partial-properties.md) ## Summary [summary]: #summary Allow the `partial` modifier on properties to separate declaration and implementation parts, similar to partial methods. ```cs // UserCode.cs public partial class ViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChanged] public partial string UserName { get; set; } } // Generated.cs public partial class ViewModel { private string __generated_userName; public partial string UserName { get => __generated_userName; set { if (value != __generated_userName) { __generated_userName = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UserName))); } } } } ``` ## Motivation [motivation]: #motivation When we did [extended partial methods](https://github.com/dotnet/csharplang/blob/main/proposals/csharp-9.0/extending-partial-methods.md), we indicated we would like to consider adding support for other kinds of partial members in the future. The community has [shown enthusiasm](https://github.com/dotnet/csharplang/discussions/3412) for partial propertie

Posted by RikkiGibson on Aug 30, 2022, 10:22 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

support (Software)

[Proposal]: Partial properties (VS 17.11, .NET 9)

RikkiGibsonAug 30, 2022, 10:22 PM

# Partial properties * [x] Proposed * [ ] Prototype: N/A * [ ] Implementation: [features/partial-properties](https://github.com/dotnet/roslyn/features/partial-properties) * [ ] Specification: [partial-properties.md](https://github.com/dotnet/csharplang/blob/main/proposals/partial-properties.md) ## Summary [summary]: #summary Allow the `partial` modifier on properties to separate declaration and implementation parts, similar to partial methods. ```cs // UserCode.cs public partial class ViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChanged] public partial string UserName { get; set; } } // Generated.cs public partial class ViewModel { private string __generated_userName; public partial string UserName { get => __generated_userName; set { if (value != __generated_userName) { __generated_userName = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UserName))); } } } } ``` ## Motivation [motivation]: #motivation When we did [extended partial methods](https://github.com/dotnet/csharplang/blob/main/proposals/csharp-9.0/extending-partial-methods.md), we indicated we would like to consider adding support for other kinds of partial members in the future. The community has [shown enthusiasm](https://github.com/dotnet/csharplang/discussions/3412) for partial propertie

Comments (0)

No comments yet. Start the discussion.

Comment on this issue