I have a question regarding C# properties with this line:
public int Ataque { get; set; }
Does this also create a variable ataque
? Or is it just to shorten the get
and set
. And it should be placed like this:
int ataque;
public int Ataque { get; set; }
Because I have been told that by style guide, the properties have to be in uppercase, and the variables in lowercase. And that bothers me a bit...
Effectively,
is a shorthand way of creating a property, which is internally handled as if a variable existed
private int ataque
.On the other hand, you can also create the property in the "classic" way with its associated private variable :
And as for convention, private variables would start with a lowercase , and properties with an uppercase .