4 ms·
> 99%+ of getters and setters could be replaced with public fields. Actually it makes more sense the other way around. Fields are just an optimization; the di
by wvenable 9y ago
> 99%+ of getters and setters could be replaced with public fields.
Actually it makes more sense the other way around. Fields are just an optimization; the different between fields and properties is one has direct memory access and the other is a method. Properties/methods are far more powerful: their implementation can change, they can be virtual and overridden, etc.
Maybe we could have had just properties and the JIT could have optimized them into direct memory access if they were backed by a simple field.