关于 LINQ数据类型
anlun 2014-06-20 04:26:07
public Object GetData()
{
.......
var selectover = from c in allsearch
group c by c.msgtype into overdata
select new { msgtype = overdata.Key, overdata };
return selectover.ToList();
}
Object A=GetData();
现在如何取Object A数据
通过这样强制转换报错
public class usermsgtype
{
public string msgtype;
public CoreSYSModel.sendmessage[] overdata;
}
List<usermsgtype> m_List = (List<usermsgtype>)A;
提示为无法将类型为“System.Collections.Generic.List`1[<>f__AnonymousType3`2[System.String,System.Linq.IGrouping`2[System.String,CoreSYSData.CoreSYSModel+sendmessage]]]”的对象强制转换为类型“System.Collections.Generic.List`1[CoreSYS.usermsgtype]”