我正在进行LINQ查询,我从表视频中选择视频信息.查询仅选择以下列表中存在ID的视频:
List<int> results; //Has some values
var query = from l in dataContext.Videos
where results.Contains(l.ID)
select l;
Run Code Online (Sandbox Code Playgroud)
现在如何在查询中订购项目(视频信息),使其ID与List结果的顺序相同?
我可以这样做:
List<int> results; //Has some values
var query = from k in results
from l in dataContext.Videos
where k==l.ID
select l;
Run Code Online (Sandbox Code Playgroud)
但这很慢,我需要更快的东西.