내 문제는 ToLinq() 메소드입니다 arrayIndex n을왜 첫 번째 쿼리 .ToList()는 작동하지만 두 번째 쿼리는 작동하지 않습니까? LINQ 표현의</p> <p>(노드 유형 : 문제없이 첫 번째 요청 작업,하지만 두 번째는 나에게 같은 예외를주는 이유</p>이 <p>내가 understind하지 않습니다
var q = from a in ctx.ImmImmobilisations select a;
q = q.Where(x => x.CodeEntite == "EDEF");
q = q.Where(x => x.CodeAffectation == "000001");
q = q.Where(x => x.Unite == "ITS");
q = q.OrderBy(x => x.CodeImmobilisation);
List<ImmImmobilisation> res = q.ToList();
var query = from e in ctx.ImmImmobilisations select e;
if (!string.IsNullOrEmpty(args[0])) query = query.Where(x => x.CodeEntite == args[0]);
if (!string.IsNullOrEmpty(args[1])) query = query.Where(x => x.CodeAffectation == args[1]);
if (!string.IsNullOrEmpty(args[2])) query = query.Where(x => x.CodeFamille == args[2]);
if (!string.IsNullOrEmpty(args[3])) query = query.Where(x => x.CodeCCout == args[3]);
if (!string.IsNullOrEmpty(unite)) query = query.Where(x => x.Unite == unite);
query = query.OrderBy(x => x.CodeImmobilisation);
var ress = query.ToList();