0
我的模型类是这样的:铸造匿名类型称为模型
Public class abc {
public string p1 get; set;
public string p2 get; set;
}
,我试图投这样
IEnumerable<abc> data= (IEnumerable<abc>) (from d in d.GetAll()
select new {
p1= d.p1,
p2= d.p2
}).Distinct();
这是给我的错误:
Unable to cast object of type <DistinctIterator>
请告知
在stackoverflow快速搜索已透露这篇文章可能有所帮助:[Linq类型转换泛型类型](http://stackoverflow.com/questions/8204930/linq-type-conversion-on-generic-types ) – Jeremy