CommunityToolkit / dotnet

.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
https://docs.microsoft.com/dotnet/communitytoolkit/?WT.mc_id=dotnet-0000-bramin
Other
2.99k stars 294 forks source link

Add optional PropertyName parameter to the ObservablePropertyAttribute #706

Closed failwyn closed 1 year ago

failwyn commented 1 year ago

Overview

It would be nice to have the ability to override the generated property name with the ObservablePropertyAttribute

API breakdown

CommunityToolkit.Mvvm.ComponentModel;

Usage example

[ObserableProperty("SSN")
private string ssn;

Breaking change?

No

Alternatives

Manually create the property

Help us help you

No, just wanted to propose this

Sergio0694 commented 1 year ago

There are no plans to add new properties to [ObservableProperty] to customize generation from fields. This scenario will implicitly be supported by #555, as you'll be able to just change the name of the property directly 🙂