public EmployeeProcessOutput RetrieveEmployee(EmployeeProcessInput input)
{
var employee = input.Employee;
if (input.EmployeeId == null)
employee= CreateEmployee(employee);
return new EmployeeProcessOutput
{
Employee = employee,
State = "Stored"
};
}
private Employee CreateEmployee(employee)
{
//Call a service to create an employee in the system using the employee
//info such as name, address etc and will generate an id and other
//employee info.
var output = Service(employee)
var employee = output.Employee;
return employee;
}
是否有一個乾淨的方法並將僱員參數傳遞給CreateEmployee
方法。我覺得這條線可能更清潔:傳遞參數的清潔方式
employee = CreateEmployee(employee);
有什麼想法?
你的代碼不會編譯 – Grundy
你不必編譯。只需要一個更乾淨的方式來做到這一點。 – user1527762
你的意思是乾淨? wat問題或不一致(你認爲)現在有嗎?順便說一句,'CreateEmployee'簽名似乎完全沒問題。 –