2022-12-31 15:16:43 +00:00
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
|
namespace Elsa.Extensions;
|
2022-09-02 11:18:53 +00:00
|
|
|
|
|
|
|
|
public static class CollectionExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void AddRange<T>(this ICollection<T> target, IEnumerable<T> source)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in source) target.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void RemoveWhere<T>(this ICollection<T> collection, Func<T, bool> predicate)
|
|
|
|
|
{
|
|
|
|
|
var itemsToRemove = collection.Where(predicate).ToList();
|
|
|
|
|
foreach (var item in itemsToRemove) collection.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|