Since properties can have public and private getters / setters, is there still a use for fields? Any behaviour you get from using fields can be gotten by designing the get / set blocks of properties to use the invisible variable that the compiler uses, and leaving the fields out alltogether?
Share
no, auto-implemented props do NOT remove the need for backing fields. Sometimes, a property getter/setter does more work then just hold a value. There are many cases where you may want a field. a very good example is when implementing INotifyPropertyChanged for binding.
like so:
this would be impossible without backing fields.