v1.3.0
Change log
-
ForEach
methods now return the original collection to allow for fluent syntax. -
The
AddRange
overload that accepts a predicate and a converter takes an additional parameter - a predicate that works on the converted data. The first predicate parameter works on the data before it is converted.
var list = new List<int> {1, 2, 3};
var dataToAdd = new[] {"7", "8", "9", "10", "11", "12"};
list.Add(dataToAdd,
s => s.Length == 1, // Predicate on string - only strings of length 1
s => int.Parse, // Converter - converts string to int
n => n % 2 == 0); // Predicate on int - only even numbers
- Added
InsertRange
extension methods onIList<T>
that inserts one or more items to a collection at a specific location.
Low impact breaking changes
-
Moved methods from
CollectionExtensions
class to other classes based on the interface they are extending. So, methods that extendIEnumerable<T>
are moved toEnumerableExtensions
and methods that extendIList<T>
are moved toListExtensions
. Methods that extendICollection<T>
remain in the same class.This is only a breaking change if you call these methods as static methods instead of as extension methods.
int[] array = new int[10];
// Calling as a static method - This will break
CollectionExtensions.Fill(array, 7);
// Calling as an extension method - This will not break
array.Fill(7);