Re:.NET Framework – What's New in C# 7.0
by batina on Thursday November 17, 2016 @08:04AM
(#12977055)
I don't think its possible with data annotations because there will me more complex logic in setter then I described.
I would just like to see get working like in auto-implemented property (without backing field) but setter to be manually implemented (with value keyword).
Also you can use propfull snippet for full property implementation.
Normal auto-implemented properties are fine:
As are read-only ones: Yet, I feel that if you are writing logic in there then you should fully control it. Or else there is too much being done that is non-obvious and could cause problems down the line (for others or your future self).However, they might be able to achieve something with data annotations that wouldn't be too magic. For example:
Tip: In VS you can just type "prop" then press tab to auto-generate the code for a class property. You can then easily auto-change this to a fully implemented version. This also works for "for" and "foreach" loops etc.I haven't done much Java in a while but do you still have to write out all of your property accessors fully? Might not be too bad if the IDE can generate this code.