How do I get results from a link query in the order of IDs that I provide?
- by Keltex
I'm looking to get query results back from Linq in the order that I pass IDs to the query. So it would look something like this:
var IDs = new int [] { 5, 20, 10 }
var items = from mytable in db.MyTable
where IDs.Contains(mytable.mytableID)
orderby // not sure what to do here
select mytable;
I'm hoping to get items in the order of IDs (5, 20, 10).
(Note this is similar to this question, but I would like to do it in Linq instead of SQL)