/// <summary> /// Combines the first predicate with the second using the logical "or". /// </summary> public static Expression <Func <T, bool> > Or <T>(this Expression <Func <T, bool> > first, Expression <Func <T, bool> > second) { return(first.Compose(second, Expression.OrElse)); }
public static Expression <Func <T, bool> > And <T> (this Expression <Func <T, bool> > first, Expression <Func <T, bool> > second) { return(first.Compose <Func <T, bool> > (second, new Func <Expression, Expression, Expression> (Expression.And))); }
/// <summary> /// Combines the first predicate with the second using the logical "and". /// </summary> public static Expression <Func <T, bool> > And <T>(this Expression <Func <T, bool> > first, Expression <Func <T, bool> > second) { return(first.Compose(second, Expression.AndAlso)); }
/// <summary> /// 以 Expression.OrElse 组合两个Expression表达式 /// </summary> /// <typeparam name="T">表达式的主实体类型</typeparam> /// <param name="first">第一个Expression表达式</param> /// <param name="second">要组合的Expression表达式</param> /// <returns>组合后的表达式</returns> public static Expression <Func <T, bool> > Or <T>(this Expression <Func <T, bool> > first, Expression <Func <T, bool> > second) { first.CheckNotNull("first"); second.CheckNotNull("second"); return(first.Compose(second, Expression.OrElse)); }