Why do people do this
int myInt { get; set; }
rather than just this?
int myInt;
Why do people do this
int myInt { get; set; }
rather than just this?
int myInt;
Some code will make it simple for you to start with.
What do you prefer?
this?:
private int _myInt;
public int GetMyInt()
{
return _myInt;
}
public void SetMyInt(int value)
{
_myInt = value;
}
or this?:
int myInt { get; set;}
Properties makes it easy. you can read more information here.