0
我们如何将where条件添加到linq subselect查询中。linq where subsection的条件
即
List<CallLog> callLog = CallLog.SampleData();
List<Contacts> contacts = Contacts.SampleData();
var q = from call in callLog
where call.Incoming == true
group call by call.Number into g
select new contacts {
contact.FirstName = g.FirstName,
contact.LastName = g.LastName,
Count = g.Count(),
Avg = g.Average(c => c.Duration) <--- WHERE c.Duration > 5,
Total = g.Sum(c => c.Duration) <--- WHERE c.Duration >= 60
};
我们如何添加一个 “Where条件”,如上图所示的LINQ声明?