Getters and setters with a single statement in their bodies can be simplified using the arrow operator (=>
). This eliminates the need for braces, thereby reducing the indentation and lines used.
public int Age
{
get
{
return _age;
}
set
{
_age = value;
}
}
public int Age
{
get => _age;
set => _age = value;
}