KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm new to LINQ and LINQ to SQL and don't understand what's wrong with this code. The Excetpion.Message I get is "Query operator 'Last' is not supported." What I'm trying to do is get the earliest LastActivityUtc out of the latest 100. The code follows. 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() >= 2) { startDate = postTimes.Take(100).Last().Value; }
Tags (comma-separated)
Save Edits
Cancel