title: How to remove first element from linq query
body: <p>Im trying to consolidate a list of records of in and out times per day to the minimum number of records possible.</p>
  
  <p>What i have done so far, is grouped up the lines into the groups they need to be in, and put the in and out times in a list for each day.</p>
  
  <p>then i want to process the lists and add the first set of in and out lines onto a single line, then process the next entry and either create a new line or fill in the blanks of the previous line.</p>
  
  <p>The bit im stuck with is removing the first item from the linq result after i have processed it.</p>
  
  <p>happy to look at doing it a different way.</p>
  
  <p>here is what i have:</p>
  
  <pre><code>       List&lt;LoginRecordLine&gt; condensedLoginRecordLines = new List&lt;LoginRecordLine&gt;();
         List&lt;LoginRecordLine&gt; currentLoginRecordLines = GetLoginRecordsForLoginRecordReport(lowerDate, upperDate, sageDatabaseID, loggedInUserID);
  
          var groupedLines = from LoginRecordLine line in currentLoginRecordLines
                             group line by new { line.TimesheetID, line.WorkPatternPayRateID } into g
                             select new
                             {
                                 Lines = g,
                                 TimesheetID = g.Key.TimesheetID,
                                 PayRateID = g.Key.WorkPatternPayRateID
                             };
  
          foreach (var g in groupedLines)
          {
              var monTimes = from line in g.Lines
                             orderby line.MonTimeIn ascending
                             where line.MonTimeSpan != TimeSpan.Zero
                             select new
                             {
                                 TimeIn = line.MonTimeIn,
                                 TimeOut = line.MonTimeOut,
                                 Timesheet = line.Timesheet,
                                 PayRate = line.WorkPatternPayRate
                             };
  
              var tueTimes = //Same as monday
  
              var wedTimes = //Same as monday
  
              var thuTimes = //same as monday
  
              var friTimes = //same as monday
  
              var satTimes = //same as monday
  
              var sunTimes = //same as monday
  
  
              while (monTimes.Count() != 0 || tueTimes.Count() != 0 || wedTimes.Count() != 0 || thuTimes.Count() != 0 || friTimes.Count() != 0 || satTimes.Count() != 0 || sunTimes.Count() != 0)
              {
                  LoginRecordLine condensedLine = new LoginRecordLine();
  
                  if (monTimes.Count() &gt;0)
                  {
                      condensedLine.MonTimeIn = monTimes.First().TimeIn;
                      condensedLine.MonTimeOut = monTimes.First().TimeOut;
                      condensedLine.Timesheet = monTimes.First().Timesheet;
                      condensedLine.WorkPatternPayRate = monTimes.First().PayRate;
  
                      //*************** REVELANT PART *************/
                      //remove first item from monday list
                  }
  
                  // tue 
  
                  // wed
  
                  // etc
              }
          }
  
          return condensedLoginRecordLines;
  </code></pre>
  
  <p>Update - Working code - before performance changes</p>
  
  <pre><code> List&lt;LoginRecordLine&gt; condensedLoginRecordLines = new List&lt;LoginRecordLine&gt;();
  
                  List&lt;LoginRecordLine&gt; currentLoginRecordLines = GetLoginRecordsForLoginRecordReport(lowerDate, upperDate, sageDatabaseID, loggedInUserID);
  
                  var groupedLines = from LoginRecordLine line in currentLoginRecordLines
                                     group line by new { line.TimesheetID, line.WorkPatternPayRateID } into g
                                     select new
                                     {
                                         Lines = g,
                                         TimesheetID = g.Key.TimesheetID,
                                         PayRateID = g.Key.WorkPatternPayRateID
                                     };
  
                  foreach (var g in groupedLines)
                  {
                      var monTimes = (from line in g.Lines
                                      orderby line.MonTimeIn ascending
                                      where line.MonTimeSpan != TimeSpan.Zero
                                      select new
                                      {
                                          TimeIn = line.MonTimeIn,
                                          TimeOut = line.MonTimeOut,
                                          Timesheet = line.Timesheet,
                                          PayRate = line.WorkPatternPayRate
                                      }).ToList();
  
              var tueTimes = //Same as monday
  
              var wedTimes = //Same as monday
  
              var thuTimes = //same as monday
  
              var friTimes = //same as monday
  
              var satTimes = //same as monday
  
              var sunTimes = //same as monday
  
                      while (monTimes.Count != 0 || tueTimes.Count != 0 || wedTimes.Count != 0 || thuTimes.Count != 0 || friTimes.Count != 0 || satTimes.Count != 0 || sunTimes.Count != 0)
                      {
                          LoginRecordLine condensedLine = new LoginRecordLine();
  
                          if (monTimes.Count &gt;0)
                          {
                              condensedLine.MonTimeIn = monTimes.First().TimeIn;
                              condensedLine.MonTimeOut = monTimes.First().TimeOut;
                              condensedLine.Timesheet = monTimes.First().Timesheet;
                              condensedLine.WorkPatternPayRate = monTimes.First().PayRate;
  
                              condensedLoginRecordLines.Add(condensedLine);
  
                              monTimes.RemoveAt(0);
                          }
  
                          //etc
                      }
                  }
  
                  return condensedLoginRecordLines;
  </code></pre>