Creating Private Auto-Implemented Property

I have been using auto implemented property for a while but did not know that you can control the acessor for getter and setter. Basically I can use public at the property level and set private or protected at either getter or setter. I cant set acessor at all 3 levels meaning I cant have public defined at the property level, than set protected at the getter level and set private at the setter level. The acessor defined at the property level must be inherited by at least either getter or setter and the one left over can be separately defined as follows.

image

The acessor defined at the getter or setter must be more restrictive than the acessor defined at the property level.

No Comments