场景:我有一个列表和三个搜索过滤器。就像是:
ResultList = OriginalList.Where(filter1).Where(filter2).Where(filter3);
问题:我是否可以更新过滤器 3,然后更新 ResultList,而不让 LINQ 运行过滤器 1 和过滤器 2?(我想提高性能)
基本上,它将与以下内容相同:
Result1 = OriginalList.Where(filter1).Where(filter2);
Result2 = Result1.Where(filter3);
UpdateFilter3(); // Just changes the filter somehow
Result2 = Result1.Where(filter3);
return Result2;
这只是跟踪起来有点麻烦,我想知道是否有更聪明的方法来做到这一点?我查看了 Continuous LINQ (CLINQ: http://clinq.codeplex.com/ ),但是,它似乎只是基本上告诉 LINQ 每次只有一个过滤器更改时刷新整个 WHERE 语句。
非常感谢任何智慧之言:)
谢谢,
迈克尔