我正在尝试对linq查询进行排序,以便按List [int]中找到的ID的顺序返回结果.这是我当前的代码返回它们很好,但没有排序.
IEnumerable<NPost> nposts;
List<int> npostIDs = (from tc in db.TopComs
where tc.Type == "Comments"
select tc.NPostID).ToList();
nposts = from np in repository.NPosts
where npostIDs.Contains(np.NPostID)
select np;
Run Code Online (Sandbox Code Playgroud)
我怎样才能让nposts以List [int]中存在npostID的顺序返回结果?