While learning C#, the Property confused me a lot, as it is very similar to the member variable in class.
there are must some reasons for its existence, otherwise it will simply replaced by the member variable.
According to my research, I believe the it sometimes acts just as a member variable, but is not limited to this.
The Property can have get and set functions, which can manipulate the value before assigning it to the Property .
However, If leave the get and set method as empty, it will act just like a member variable.
Apart from this, it can be used by combining with the member variable, using Property to access to the variable, which provides a better Encapsulation.
The typical example of declare a Property is as following:
Public string ID { get; set; } //after .net framework 3.0
or
Public string ID {
get
{
// Property get code
}
set
{
//Property set code
}
}