Linq 合并多个查询条件

方法

public static Expression<Func<T, T2, T3, T4,T5, bool>> AndFive<T, T2, T3, T4,T5>(this Expression<Func<T, T2, T3, T4,T5, bool>> expr1, Expression<Func<T, T2, T3, T4,T5, bool>> expr2)
{
    //创建新参数
    return Expression.Lambda<Func<T, T2, T3, T4, T5, bool>>(Expression.AndAlso(expr1.Body, expr2.Body), expr1.Parameters);
}

 

posted @ 2024-04-25 17:09  ziff123  阅读(26)  评论(0编辑  收藏  举报