这两种定义有什么区别property
?
第一的
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
第二
public class Person
{
private string firstName;
private string lastName;
public string FirstName
{
get { return this.firstName; }
set { this.firstName = value;}
}
public string LastName
{
get { return this.lastName; }
set { this.lastName = value;}
}
}