错误 1 无法将类型“System.Collections.Generic.IEnumerable<Langben.DAL.KaoQingGuanLi>”隐式转换为“System.Collections.Generic.List<Langben.DAL.KaoQingGuanLi>”。存在一个显式转换(是否缺少强制转换?) D:\最终 - 副本\App\Controllers\KaoQingGuanLiController.cs 60 45 App

解决方案 »

  1.   

    eg:
    List<int> list = new List<int>();
                list.Add(11111);
                List<int> newList = list.Where(x => x == 11111).ToList<int>();
      

  2.   

    List<KaoQingGuanLi> queryData = m_BLL.GetByParam(id, page, rows, order, sort, search, ref total).Where(w=>w.YuanGongXingXi.SysDepartmentId=id);你不会看这里返回的类型需要转化成list类型,楼上给出代码了
      

  3.   

    IEnumerable不能隐式转换成List,Linq出来的是IEnumerable
    编译器告诉你了,转换成List就好了嘛,最后加个ToList()
    List<KaoQingGuanLi> queryData = m_BLL.GetByParam(id, page, rows, order, sort, search, ref total).Where(w=>w.YuanGongXingXi.SysDepartmentId==id)ToList()
      

  4.   

    靠,为毛点没出来List<KaoQingGuanLi> queryData = m_BLL
    .GetByParam(id, page, rows, order, sort, search, ref total)
    .Where(w=>w.YuanGongXingXi.SysDepartmentId==id)
    .ToList()