Add abilities to control the access level of generated [ObservableProperty] attribute #585
Labels
duplicate 👥
Indicates that an identical issue or PR already exists
feature request 📬
A request for new changes to improve functionality
mvvm-toolkit 🧰
Issues/PRs for the MVVM Toolkit
Overview
Currently CommunityToolkit can only generate ObservableProperties with both public getter and setter. Sometimes we need the property be private or the setter be private. Maybe we can have multiple attributes like [Readonly] to change the behavior of the generation.
API breakdown
[ObservableProperty]
[Readonly]
private int _counter; // generate property with {get;}
[ObservableProperty]
[PrivateSet]
private string _text; // generate property with {get; private set;}
Usage example
Same as previous one
Breaking change?
No
Alternatives
Maybe trying to use any attributes that C# already have?
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered: