JasinCole
Well-known member
- Joined
- Feb 16, 2023
- Messages
- 66
- Programming Experience
- 1-3
I got another dumb question, but my google searches are coming up empty.
I get the reason for properties, when one wants to expose an internal field as an API to consumers.
I also assume that public fields and private properties don't make a whole lot of sense and are rare to see.
is there any criteria where one should prefer properties with private sets instead of fields? I guess what I am asking for is some rational on how others approach this when writing code? What's your goto and when do you decide to changes things?
I get the reason for properties, when one wants to expose an internal field as an API to consumers.
I also assume that public fields and private properties don't make a whole lot of sense and are rare to see.
is there any criteria where one should prefer properties with private sets instead of fields? I guess what I am asking for is some rational on how others approach this when writing code? What's your goto and when do you decide to changes things?