Let's say I have a list of static lists of identifiers in a specific order:
List<int> ordered = new List<int> {7,2,3,4,5};
And I would like to select items from a database supporting this order.
Trivial:
var posts = ( from p in Current.DB.Posts
where ordered.Contains(p.Id)
select p).ToList();
It returns quickly, but does not work.
How to select these messages from db and maintain order in an elegant and efficient way?
source
share