.net 拉姆达表达式 追加 条件判断 Expression<Func<T, bool>>
参考原文:
https://www.cnblogs.com/keitsi/p/5621136.html
http://m.bubuko.com/infodetail-465328.html
需要引用:LinqKit
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
//定义追加的过滤变量 var searchWhere = PredicateBuilder.New<实体类>(); if (!string.IsNullOrWhiteSpace(custName)) searchWhere = searchWhere.And(t => t.CustomerName.Contains(custName)); if (!string.IsNullOrWhiteSpace(carModel)) searchWhere = searchWhere.And(t => t.CarType.Contains(carModel));