我想将 linq 结果输出到 IEnumerable 列表,但出现转换错误:
IEnumerable<vwHour> Total = (from p in vwHours.Where(ph => ph.UserName == UserName())
group p by p.Date into g
select new {Date = g.Key.Value.ToString("mm/dd/yy"), Total = g.Sum(p => p.Hours),});
错误信息:
Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Collections.Generic.IEnumerable<UI.Models.vwHour>'. An explicit conversion exists (are you missing a cast?)
我在这里错过了什么吗?