我有这个例子,它创建了 3 个表达式并将它们添加到一个表达式数组中。现在我想知道如何在循环中为未知数量的表达式做同样的事情。
Expression<Func<Product, bool>> filter1 = c => c.City.StartsWith("S");
Expression<Func<Product, bool>> filter2 = c => c.City.StartsWith("M");
Expression<Func<Product, bool>> filter3 = c => c.ContactTitle == "Owner";
Expression<Func<Product, bool>>[] filterExpressions = new Expression<Func<Product, bool>>[] { filter1, filter2, filter3 };