public List<string> GetpathsById(List<long> id)
{
long[] aa = id.ToArray();
long x;
List<string> paths = new List<string>();
for (int i = 0; i < id.Count; i++)
{
x = id[i];
Presentation press = context.Presentations.Where(m => m.PresId == aa[i]).FirstOrDefault();
paths.Add(press.FilePath);
}
return paths;
}
Run Code Online (Sandbox Code Playgroud)
此代码抛出以下异常: The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities.
但是,如果我提供x而不是aa[i]它的工作.
为什么?