I have a list with some identifiers like this:
List<long> docIds = new List<long>() { 6, 1, 4, 7, 2 };
Morover, I have another list of <T> elements that are represented by the identifiers described above.
List<T> docs = GetDocsFromDb(...)
I need to keep the same order in both collections, so the elements in the List<T> should be in the same position as in the first (due to errors in the search engines). And this process cannot be executed in the GetDocsFromDb() function.
If necessary, you can change the second list to some other structure (for example, Dictionary<long, T> ), but I would prefer not to change it.
Is there a simple and effective way to do this "sorting by some identifiers" with LINQ?
collections sorting c # linq order
Borja Lรณpez Mar 07 '13 at 15:36 2013-03-07 15:36
source share