Auto-implemented getters and setters vs. public fields

I tend to agree (that it seems needlessly verbose), although this has been an issue our team hasn’t yet resolved and so our coding standards still insist on verbose properties for all classes.

Jeff Atwood dealt with this a few years ago. The most important point he retrospectively noted is that changing from a field to a property is a breaking change in your code; anything that consumes it must be recompiled to work with the new class interface, so if anything outside of your control is consuming your class you might have problems.

Leave a Comment