c#: getter/setter
That is an auto-property and it is the shorthand notation for this:
private string type;
public string Type
{
get { return this.type; }
set { this.type = value; }
}
Those are Auto-Implemented Properties (Auto Properties for short).
The compiler will auto-generate the equivalent of the following simple implementation:
private string _type;
public string Type
{
get { return _type; }
set { _type = value; }
}
In C# 6:
It is now possible to declare the auto-properties just as a field:
public string FirstName { get; set; } = "Ropert";
Read-Only Auto-Properties
public string FirstName { get;} = "Ropert";