tags:

views:

42

answers:

1

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 [event] that has the earliest [appointment] [startTime]"

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

A: 

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

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