Ability to provide Get/Set body on Properties
Closed this issue · 2 comments
Nick-Lucas commented
Often there is a need to provide functionality beyond a simple auto-property, for instance building a full property with a backing field, and coercing the backing field from null to something else.
MilleBo commented
I guess this shouldn't be too hard, we simply have to find a good way to add properties with blocks (one for get and one for set).
My first thought is just to add add another property class (that inherit from property) but I will play around with it a bit and see how it feels.
MilleBo commented
I have now release a new version (0.2.0) with this feature. The final solution is:
Split Property to three classes
- Property - Abstract base class
- AutoProperty - Auto property (the same as the old property class)
- BodyProperty - You can now add a body/block to both get and set.
Also added a new reference class "ValueKeywordReference" so it's easier to use the new properties. You can find an example here: