如何将SelectList转换为List()?
代码:
Session["Employers"] = new SelectList(employers.DistinctBy(i => i.empId), "EmpId", "EmpName");
答案 0 :(得分:1)
最后添加ToList()
。
Session["Employers"] = new SelectList(employers.DistinctBy(i => i.empId), "EmpId", "EmpName").ToList();