return new Employee{FirstName=firstName,LastName=lastName};是什么用法

问题描述:

return new Employee{FirstName=firstName,LastName=lastName};是什么用法
public class Employee
{
public static Employee CreateEmployee(string firstName,string lastName)
{
return new Employee{FirstName=firstName,LastName=lastName};
}
public string FirstName{get;set;}
public string LastName{get;set;}
}

这叫对象初始化器,具体用法请参考: