C# extensions for modifying collections.
The AddRange() method takes an IEnumerable collection and adds the items in the collection to the source ICollection.
var source = new HashSet<int>();
var collection = new HashSet<int>();
source.AddRange(collection);
The RemoveRange() method takes an IEnumerable collection and removes the items in the collection from the source ICollection.
var source = new HashSet<int>();
var collection = new HashSet<int>();
source.RemoveRange(collection);
The Batch() method takes an int batchSize variable and returns a list of lists with the specified batch size.
var source = new HashSet<int>();
var batchSize = 5;
var batches = source.Batch(batchSize);