suroma
asked on
Linq query for top 1
i am trying to retrieve the top 1 object from the following query but it is not working as expected. Please help.
Dim LastQuestion As Question = (From q In qu Order By q.QuestionNumber Descending Take 1 Select q)
Sorry it was c# syntax.
give us your definition of qu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also your Question has to implement IComparable
ASKER
Works perfectly. Many thanks!
Dim LastQuestion As Question = (From q In qu Order By q.QuestionNumber Descending Select q).Take(1)