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/12/18 19:54:17
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
这叫对象初始化器,具体用法请参考: