UPDATE: I’ve cleaned up the code a bit and put it up on CodePlex at http://ordertolist.codeplex.com/ A team member recently wanted LINQ-to-SQL to perform a query with a Contains() clause and return the results in the same order. For example, he was passed a list of People: 1: List<int> idsOfPeopleToDisplay = new List<int> { 578, 291, 788, 230, 45 };
and he wanted to select all People from the database with those IDs, in that order. The following will result in a non-correctly ordered...