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;
精彩评论