Sort a list from another list IDs
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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> items, which are represented by the ids described above. List<T> docs = GetDocsFromDb(...) I need to keep the same order in both collections, so that the items in List<T> must be in the same position than in the first one (due to search engine scoring reasons). And this process cannot be done in the GetDocsFromDb() function. If necessary, it's possible to change the second list into some other structure (