Return anonymous type from LINQ query?

前端 未结 2 1946

In that in business logic layer, I have created a class like this:

public List SelectAllData()
{
    try
    {
        return (from obj i         


        
2条回答
  •  不要未来只要你来
    2021-01-17 01:40

    If you return RoleHasRight you need to construct it, not an anonymous type as you do now:

    select new RoleHasRight
    {
        obj,
        role.roleName
    }).ToList();
    

提交回复
热议问题