The documentation for Access.BackingField()
indicat开发者_如何学Pythones that this:
Sets the access-strategy to use the backing-field of an auto-property.
I understand that auto-properties get compiled with backing fields, but if the property is by definition a vanilla getter/setter, what advantage is garnered by going to the backing field directly versus using the setter (i.e. using the FNH defaults).
The only thing I can think of is that one might want the mapping to break if someone later adds logic to the setter.
What am I missing?
Ah, I think I found the answer here.
Use the backing field if the auto-property has a private
accessor.
精彩评论