Re:Why most “clever” code ain’t so clever after all
by tigershark on Wednesday July 13, 2016 @01:58AM
(#12084134)
You don't need getters and setters in c#. If you don't have any side effect in a read-write property you can just use an automatic property. The same for read only properties that don't need to be recalculated on the fly. And I hope that I don't need to explain why using a write only property is almost always a code smell.
In the other cases you can use a normal property with a backing field.
If your code is well written and you use the appropriate tools, only rarely you need normal properties (that are as annoying as getters/setters).
What do getters and setters offer that public fields don't? Properties offer exactly the same advantage as getters and setters, fields encapsulation https://en.m.wikipedia.org/wiki/Field_encapsulation No wonder that you don't understand properties if you don't know why getters and setters are useful.
This was one of things that always bothered me about C#, What is the point of properties. What do the offer that public fields don't?