I want to get the last result returned from this query. How do I do this? Last and LastOrDefault aren’t supported by Linq to Sql.
var docs = (from d in db.Documents where d.Version > 1 orderby d.DocumentID select new { d.DocumentID, d.DocTypeID, d.Name, d.Version });
Reverse your sort criteria (add
descending) and useFirst(orFirstOrDefaultas appropriate).