Closed Pantheas closed 5 months ago
I find this to be very compelling.
Please enable customization of the ObservableProperty
, by adding some properties to it, to control accessibility modifiers of its methods, as well as making it virtual, to enable inheriting classes to override and intercept the changing/ed calls.
This is not doable, as adding an accessibility modifier to a partial method without implementation makes it required to implement it. Right now, the point is that you only implement the ones you need (which is also why there's multiple overloads that are generated). If we added protected
, you'd be forced to always implement all those 4 methods for each single property you have, even if you don't actually need them at all.
Overview
It would be nice if the following methods could get a
protected
modifier instead ofprivate
so these methods can be accessed from derived classes aswell. I have scenarios in which I define common properties tagged with[ObservableProperty]
in a base class. However, if I want to react on changes from a derived class I currently have to implement a wrapping method just to modify the accessibility.API breakdown
Usage example
Breaking change?
No
Alternatives
Additional context
Help us help you
Yes, but only if others can assist I have never worked with source generators so far. However, I'm interesting in it and I am up to contribute a solution with some assistance.