title: Linq Method Error IOrderedQueryable
body: <p>I have a database with a specific id with recorded Time's, I need help on trying to figure out time gap's between an ID's time's e.g 13:05:15 and 13:05:45 though if the time gap is over 10/15 seconds it needs to be recorded so it can be used in say a text file/other data etc. I previously asked a similar question on here, here is what my code looks like so far:</p>
  
  <p>This class is used to manipulate data through the linq var being queried/looped            </p>
  
  <pre><code>public class Result
  {
      public bool LongerThan10Seconds { get; set; }
      public int Id { get; set; }
      public DateTime CompletionTime { get; set; }
  }
  </code></pre>
  
  <p>This is the foor loop within a separate class which was my original idea</p>
  
  <pre><code>using (var data = new ProjectEntities())
  {
      Result lastResult = null;
      List&lt;Result&gt; dataResults = new List&lt;Result&gt;();
  
      foreach(var subResult in data.Status.Select(x =&gt; x.ID).Distinct().Select(Id =&gt; data.Status.Where(x =&gt; x.ID == Id).OrderBy(x =&gt; x.Time)))
      {
          if (lastResult != null)
          {
              if (subResult.CompletionTime.Subtract(lastResult.CompletionTime).Seconds &gt; 10)
                  dataResults.Add(subResult);
          }
          lastResult = subResult;
      }
  </code></pre>
  
  <p>Which I got the error:</p>
  
  <pre><code> Linq.IOrderedQueryAble does not contain a definition for 'CompletionTime' and no Extension method 'CompletionTime' accepting a first argument of type 'System.Linq.IOrderedQueryable.
  </code></pre>
  
  <p>I changed the for loop to use an object of the manipulation class </p>
  
  <pre><code>foreach(Result subResult in data.AssetStatusHistories.Select(x =&gt; x.ID).Distinct().SelectMany(Id =&gt; data.AssetStatusHistories.Where(x =&gt; x.ID == Id).OrderBy(x =&gt; x.TimeStamp)))
  {
      if (lastResult != null)
      {
          if (subResult.CompletionTime.Subtract(lastResult.CompletionTime).Seconds &gt; 10)
          {
              vehicleResults.Add(subResult);
          }                
      }
  
      lastResult = subResult;
  }
  </code></pre>
  
  <p>Though now I get the error: <code>Cannot convert type 'Project.Status' to 'Project.Result'</code></p>
  
  <p>Does anyone possibly have a solution to get around this I have looked through a few resources but haven't been able to find anything of helps also even on Microsoft's Linq Forum. Any help is much appreciated ! :)</p>