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 –