ICollection extensions - siof/common.extensions GitHub Wiki

ICollection extensions

AddRange

void AddRange<T>(this ICollection<T> collection, IEnumerable<T> toAdd)

Simple foreach with adding each item to collection (using ICollection<T>.Add).

RemoveRange

void RemoveRange<T>(this ICollection<T> collection, IEnumerable<T> toRemove)

Simple foreach with removing each item from collection (using ICollection<T>.Remove).

RemoveIf

ICollection<T> RemoveIf<T>(this ICollection<T> collection, Func<T, bool> predicate)

Collection is filtered using given predicate. Returned items are removed from collection.

⚠️ **GitHub.com Fallback** ⚠️