+ 6
What is the point of an auto implemented property?
if you don't need the custom behavior control..simply declare a public variable. No?
11 ответов
+ 4
Its never correct to have public variables cuz it is much easier to Edit logic through property
+ 3
i think like you.
+ 2
if no custom behavior needed, yes you can... but later maybe you want to upgrade/expand your code. then you will see a benefits of auto implemented properties...
+ 2
An auto-implemented property can be made read-only, whereas a public data member is always read-write.
+ 1
@Ronaldo Marques ME TOO, I HAVEN'T FOUND THE ANSWER
+ 1
auto implemented property makes the code faster to write. thinking of it as an option to use when you want a quick way to make a private variable with getters and setters.
0
I believe you are correct in that if you dont need the custom behavior then just declaring the variable as public is correct (and simpler imo)
0
I've noticed that high level languages are redundant in so many ways, but I trust in language developers know what they are doing. I have no idea right now why I should use this redundant way of accessing fields but I surely will.
0
I believe this can help you:
please give it a look as it actually helps
http://stackoverflow.com/questions/6001917/what-are-automatic-properties-in-c-sharp-and-what-is-their-purpose
0
to implement encapsulation automatically
0
i think like you.