Private Property #72
LangSensei
started this conversation in
General Discussions
Replies: 1 comment
-
I use private properties now to enable Another reason I've used private properties was for lazy caching. Just like I don't put much stock in rules that say "you can never do X" (do whatever works!), I'm similarly unimpressed by rules that say "always do X." The "unified and consistent" goal feels dangerously close to the latter to me, personally. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it really a bad usage of defining "private property" in class?
I know, private property doesn't sound to make sense since we should only define private fields, and define public property to expose things.
However, due to the runtime optimization, a inline property has the similar execution speed as a private field. By using only property in classes can make our codes more unified and consistent.
Wouldn't it be a good habit of always using property?
Beta Was this translation helpful? Give feedback.
All reactions