namespace DD.Persistence.Extensions; public static class IEnumerableExtensions { public static void ForEach(this IEnumerable source, Action action) { if (source == null) throw new ArgumentNullException(nameof(source)); if (action == null) throw new ArgumentNullException(nameof(action)); foreach (var item in source) { action(item); } } public static bool IsNullOrEmpty(this IEnumerable? enumerable) { if (enumerable == null) { return true; } var collection = enumerable as ICollection; if (collection != null) { return collection.Count < 1; } return !enumerable.Any(); } }