开发者

Help with LINQ statement

If I was just wanting the earliest [event] [startTime] I'd write:

events.Min(ev => ev.StartTime);

How can I extend this to say:

"select the [startTime] for the [eve开发者_开发知识库nt] that has the earliest [appointment] [startTime]"

(An [event] has an Appointments collection of [appointment])


Sort by min appointment start time and take the first, something like:

events.OrderBy(ev => ev.Appointments.Min(app => app.StartTime)).First().StartTime; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜