【发布时间】:2016-09-24 06:23:44
【问题描述】:
在给定的代码中,我编写了 lambda 表达式,但它显示了一个错误——无法将 lambda 表达式转换为类型“字符串”,因为它不是委托类型。
EmployeeDataOperation emp = new EmployeeDataOperation(); //Class to perform CRUD operation.
List<EmployeeProp> data = new List<EmployeeProp>();
dt = emp.getEmployeeData();//return datatable with records.
//I want to use lambda expression to use Datatable data as a list
data = (from a in dt
select new EmployeeProp { Name = a.Name, Email = a.Email }).ToList();
//error near select
return View(data);
【问题讨论】:
-
这里我已经提到我要使用lamda表达式。
标签: c# asp.net-mvc model-view-controller