C
C#2y 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
Anu6is2y ago
yes?
Angius
Angius2y ago
Sure, you can add validation logic to the property
Anu6is
Anu6is2y 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
Accord2y 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.