一段时间以来一直被此错误困扰。基本上我有 2 个 C# 类库 HeldDeskBusinessData 和 HelpDeskBusinessUser(简称为标题)
来自 HelpDeskBusinessData
public List<Employee> GetAll()
{
HelpDeskDBEntities dbContext = new HelpDeskDBEntities();
List<Employee> employees = dbContext.Employees.ToList();
List<Employee> busEmployees = new List<Employee>();
try
{
foreach (Employee emp in employees)
{
Employee empBus = new Employee();
empBus.Title = emp.Title;
empBus.FirstName = emp.FirstName;
empBus.LastName = emp.LastName;
empBus.PhoneNo = emp.PhoneNo;
empBus.Email = emp.Email;
empBus.DepartmentID = emp.DepartmentID;
empBus.EmployeeID = emp.EmployeeID;
busEmployees.Add(empBus);
}//end foreach
}//end try
catch (Exception ex)
{
throw new Exception(ex.Message);
}//end catch
return busEmployees;
}//end getallemployees
来自 HelpdeskBusinessuser 包含错误(标签)
public List<EmployeeBusinessUser> GetAll()
{
EmployeeBusinessData empBD = new EmployeeBusinessData();
List<Employee> empL = new List<Employee>();
List<EmployeeBusinessUser> empBU = new List<EmployeeBusinessUser>();
empL = empBD.GetAll(); /*error cant explicitly convert. */
try
{
foreach (Employee emps in empL)
{
EmployeeBusinessUser empBus = new EmployeeBusinessUser();
empBus.Title = emps.Title;
empBus.FirstName = emps.FirstName;
empBus.LastName = emps.LastName;
empBus.PhoneNo = emps.PhoneNo;
empBus.Email = emps.Email;
empBus.DepartmentID = emps.DepartmentID;
empBU.Add(empBus);
}//end foreach
}//end try
catch (Exception ex)
{
ErrorRoutine(ex, "EmployeeBusinessUser", "GetAll");
}
return empBU;
}//end getallemployees
有人知道如何解决吗?