【发布时间】:2017-03-05 05:17:08
【问题描述】:
我正在尝试为现有的 Func 属性列表创建 Contains 子句,但我不知道如何将其附加到以前传递的属性列表中。
public static List<Func<T, bool>> GetPropertyWhereClauses<T>(List<Func<T, object>> properties, string queryPhrase)
{
var whereClauses = new List<Func<T, bool>>();
foreach (var property in properties)
{
/// how to add Contains to existing property Func<T, object> ?
whereClauses.Add(property.Contains(queryPhrase));
}
return whereClauses;
}
如何添加?我尝试使用一些 Expression.Call 但它没有将 Func 作为参数。
【问题讨论】:
标签: c# linq properties where contains