Path: redb/redb.Core/Utils/appExt.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Utils/appExt.cs ---- using System.Collections; using System.Linq.Expressions; namespace redb.Core.Utils { public static class appExt { public static void forEach(this IEnumerable d, Action a) { foreach (object? i in d) { a((T)i); } } #pragma warning disable CS8600, CS8602, CS8603, CS8604 public static void forEach(this IDictionary source, Action action) => source.forEach(i=>action((K)i.Key,(V?)i.Value)); /// /// Filter IQueryable by property name dynamically. /// Uses expression trees instead of EF.Property. /// public static IQueryable Filter(this IQueryable query, string propertyName, object propertyValue) { var parameter = Expression.Parameter(typeof(T), "e"); var property = Expression.Property(parameter, propertyName); var value = Expression.Constant(propertyValue); var equals = Expression.Equal(property, Expression.Convert(value, property.Type)); var lambda = Expression.Lambda>(equals, parameter); return query.Where(lambda); } #pragma warning restore CS8600, CS8602, CS8603, CS8604 } }