C
C#3y ago
Defender

❔ Help

is it okay to define the set function of a property as public but add it a statement that checks that the value i got is matching according to my needs?
4 Replies
Anu6is
Anu6is3y ago
yes?
Angius
Angius3y ago
Sure, you can add validation logic to the property
Anu6is
Anu6is3y ago
your question is a bit vague but part of the benefit of using getters and setter is that you can add logic to them to control what is being set or retrieved
Accord
Accord3y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?