LINQ Dates Overlapping logic

May 8 2015 10:24 AM
StudentId        StartDate         EndDate
 1                1/1/2013        31/12/2013
 1                1/1/2014        31/12/2014
 2                1/1/2013          1/11/2013
 2                1/1/2015        31/12/2015


My LIST contains sample date like above.Here student "1" continued next year also,
In this case i want to show one record for him like below.
Here student 2 is discontinued so in this case i want to show two records also.
Finally i want to show the output like below .How Can i do this using LINQ query ?


StudentId        StartDate         EndDate
 1                1/1/2013        31/12/2014
 2                1/1/2013        1/11/2013
 2                1/1/2015        31/12/2015

Answers (3)