开发者

How to write this linq query using Lambda expression

How to write this linq query using Lambda expression

public List开发者_Python百科<Employee> GetList()
 {
     return (from c in DALContext.MST
             select new Employee(ID=c.CD, Name=c.NAME)).ToList();
 }


Try this:

public List<Employee> GetList()
{
    return DALContext.MST.Select(c => new Employee { ID = c.CD, Name = c.NAME }).ToList();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜