【发布时间】:2019-04-11 19:14:47
【问题描述】:
我这样定义了一个List:
List<Agahii.Ads> ads = new List<Agahii.Ads>();
然后我想用 LINQ 查询的结果来填充它:
for (int i = 0; i < adid.Count(); i ++ )
{
var dd = adid[i];
var cc = (from a in context.Ads where a.AdID == dd select a).ToList();
ads.Add(cc); // error appears here
};
ads.Add(cc); 行中出现错误。
错误:System.Collections.Generic.List.Add(Agahii.Ads) 的最佳重载方法匹配有一些无效参数
【问题讨论】: