-6

如何将这两段代码合二为一?

comCtrList = (from i in genOutList
                                  join f in genAccList
                                          on i.Contract equals f.Contract
                                  select i.Contract).ToList();

genOutList.RemoveAll(acc => comCtrList.Contains(acc.Contract));
4

1 回答 1

0

你想要这样的东西吗?

genOutList= (
                  from i in genOutList
                  where !genAccList.Any(x=>x.Contract==i.Contract)
                  select i
             ).ToList();

或者

genOutList.RemoveAll(x=>genAccList.Any(i=>i.Contract==x.Contract));
于 2012-08-20T14:54:23.863 回答