如何将object转换成list

shaobing012 2015-11-04 01:05:03

public object selecta()
{

var query = from A in Context.AccidentMsg
join B in Context.PeopleMessage on A.AccID equals B.AccID
join C in Context.SysDictionary on A.DealWayID equals C.ID
//join D in Context.PoliceMan on A.PoliceNo equals D.PoliceNo
join E in Context.SysDictionary on B.Responsibility equals E.ID

select A;
return query;


应该怎样转换成list<>集合呢
...全文
1423 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
南天空 2015-11-04
  • 打赏
  • 举报
回复
楼上正解,类型确定不了,只能原样封装了
exception92 2015-11-04
  • 打赏
  • 举报
回复
query 应该是一个 IEnumberable<T> 接口的集合,遍历之后 添加到List集合中 返回不就行了。
  • 打赏
  • 举报
回复
public List<AccidentMsg> selecta()
    {
 
        var query = from A in Context.AccidentMsg
                    join B in Context.PeopleMessage on A.AccID equals B.AccID
                    join C in Context.SysDictionary on A.DealWayID equals C.ID
                    //join D in Context.PoliceMan on A.PoliceNo equals D.PoliceNo
                    join E in Context.SysDictionary on B.Responsibility equals E.ID
 
                    select A;
         return query.ToList();
}
BitCoffee 2015-11-04
  • 打赏
  • 举报
回复
return query.ToLost();

110,502

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧