The second solution is the same as the first one only that it is more extended.
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
This is the default way of creating a public value, however if you want anything to be done while setting or getting the value you use the second solution, which is the same as the first one but extended.
For instance if you would want to only have names in lowercase you would use the following code:
public class Person
{
private string firstName;
private string lastName;
public string FirstName
{
get { return this.firstName; }
set { this.firstName = value.ToLower();}
}
public string LastName
{
get { return this.lastName; }
set { this.lastName = value.ToLower();}
}
}