Why do we need a getter for just for example getting the field of an object in C#? Setter makes sense to me for its purpose, for example, to validate data, or add some algorithm when changing a field.
Dat Pham
1
Reputation point
Why do we need a getter for just for example getting the field of an object in C#? Setter makes sense to me for its purpose, for example, to validate data, or add some algorithm when changing a field. I mean if we are going to get the value of the field, just make a public field and done.
Developer technologies | C#
11,579 questions
Sign in to answer