I have a class that represents a shift that an employee can do:
public class Shift { public int Id { get; set;} public DateTime Start {get;set;} public DateTime End { get; set;} public DayOfWeek Day { get; set;} }
And I will say that I have a list of these shifts for one employee:
List<Shift> myShifts;
I know that I can move groups with each following linq expression:
var shiftsByDay = from a in myShift group a by a.Day;
My question is: For each day, how can I get all the shifts that overlap in separate groups without double counting?
A shiftable shift is one where either the start or end time overlaps with other start or end shift times.
I would like it to be possible with linq, if at all possible.
Alan
source share