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 FirstN
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 18:42:41
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 FirstN
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;}
}
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 FirstN
这叫对象初始化器,具体用法请参考: