Skip to content

Releases: JeevanJames/Collections

v1.6.0

20 Feb 20:51
Compare
Choose a tag to compare

Change log

  • Added overloads to the Union extension that allow single values to be added.

Where earlier you would have done this:

var nums = new int[] { 1, 2, 3, 4, 5, 6 };
nums.Union(new[] { 7 });

You can now do this:

var nums = new int[] { 1, 2, 3, 4, 5, 6 };
nums.Union(7);

Another Union overload accepts a params parameter:

var nums = new int[] { 1, 2, 3, 4, 5, 6 };
nums.Union(7, 8, 9);
  • Added an AllOrNone extension on IEnumerable<T> that determines whether a predicate matches all or none of the elements in a sequence.

  • Added an IsNotNullOrEmpty extension, which is the opposite of IsNullOrEmpty.

v1.5.0

29 Jan 09:45
Compare
Choose a tag to compare

Change log

  • Added collection extensions for additional integral types - char, int, long and short.

v1.4.0

19 Jan 08:04
Compare
Choose a tag to compare

Change log

  • Added SlidingChunk extension method, which returns overlapping consecutive chunks of a specified size from a collection.

    This is different from the Chunk extension method, which returns non-overlapping chunks.

var collection = new List<int> {1, 2, 3, 4, 5, 6};

var chunks = collection.Chunk(2);
// returns { {1, 2}, {3, 4}, {5, 6} }

var slidingChunks = collection.SlidingChunk(2);
// returns { {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6} }

v1.3.0

17 Jan 08:18
Compare
Choose a tag to compare

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 on IList<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 extend IEnumerable<T> are moved to EnumerableExtensions and methods that extend IList<T> are moved to ListExtensions. Methods that extend ICollection<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);

v1.0.0-beta.2

05 Jan 23:09
Compare
Choose a tag to compare
v1.0.0-beta.2 Pre-release
Pre-release

Change log

  • Added collection extensions, byte array extensions and enum iterator.
  • Added unit tests. Currently at 68.6% coverage.