I would like to know if there is any way to add custom behaviour to the auto property get/set methods.
An obvious case I can think of is wanting every set property method to call on any PropertyChanged
event handlers as part of a System.ComponentModel.INotifyPropertyChanged
implementation. This would allow a class to have numerous properties that can be observed, where each property is defined using auto property syntax.
Basically I'm wondering if there is anything similar to either a get/set template or post get/set hook with class scope.
(I know the same end functionality can easily be achieved in slightly more verbose ways - I just hate duplication of a pattern)
No, you'll have to use "traditional" property definitions for custom behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With