title: .NET: LINQ's Last()
body: <p>I'm new to LINQ and LINQ to SQL and don't understand what's wrong with this code. The <code>Excetpion.Message</code> I get is </p>
  
  <blockquote>
    <p>"Query operator 'Last' is not supported."</p>
  </blockquote>
  
  <p>What I'm trying to do is get the earliest <code>LastActivityUtc</code>out of the latest 100. The code follows.</p>
  
  <pre><code>var postTimes = from post in db.Post
                  where post.LastActivityUtc != null
                  orderby post.LastActivityUtc descending
                  select post.LastActivityUtc;
  
  DateTime startDate = DateTime.MinValue;
  
  if (postTimes.Count() &gt;= 2)
  {
      startDate = postTimes.Take(100).Last().Value;
  }
  </code></pre>