0
Pseduocode:是否可以编辑或扩展作为参数传递的linq表达式?
var pocos = GetPOCOs(p => !p.IsDeleted);
public List<MyPoco> GetPOCOs(Expression<Func<MyPoco, bool>> exp)
{
List<MyPoco> pocos = new List<MyPoco>();
foreach (int i in MyListOfIntegers)
{
// this will not compile - but is a similar function possible?
pocos.AddRange(GetPocos().Where(exp && p => p.PocoId == i));
}
return pocos;
}
我知道有其他的方式,我可以去这个(即只过滤列表两次),我只是好奇。
http://www.albahari.com/nutshell/predicatebuilder.aspx –