Original Post
Those of you who program in C# most likely know of the short cut to creating class properties without private fields, like so:
Obviously, doing so eliminates the need for the programmer to create private fields as VS will do it for you (results in cleaner code, etc). With that said, none of the XNA tutorials I've been reading do so. Plus, they always access the member data through the private field ( _count) instead of the property (this.Count).
I was hoping some more experienced developers could lend some insight as to why. Is it just preference? Or something else that I'm just not aware of?
Also, how do you generally do it? This is assuming, of course, that the members are public and not private/protected.
Thanks for your time.
-Justin
public int Count
{
get;
set;
}
Obviously, doing so eliminates the need for the programmer to create private fields as VS will do it for you (results in cleaner code, etc). With that said, none of the XNA tutorials I've been reading do so. Plus, they always access the member data through the private field ( _count) instead of the property (this.Count).
I was hoping some more experienced developers could lend some insight as to why. Is it just preference? Or something else that I'm just not aware of?
Also, how do you generally do it? This is assuming, of course, that the members are public and not private/protected.
Thanks for your time.
-Justin