Skip to content

Add ICollection.AddRange and ICollection.RemoveRange extension methods#39

Merged
Tyrrrz merged 4 commits intoprimefrom
copilot/add-collection-removerange-addrange
Apr 17, 2026
Merged

Add ICollection.AddRange and ICollection.RemoveRange extension methods#39
Tyrrrz merged 4 commits intoprimefrom
copilot/add-collection-removerange-addrange

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Extends CollectionExtensions with two new methods on ICollection<T>AddRange and RemoveRange — mirroring the CliFx reference implementation.

Changes

  • CollectionExtensions — adds two methods to the existing extension<T>(ICollection<T>) block:
    • AddRange(IEnumerable<T> items) — iterates and calls Add for each element
    • RemoveRange(IEnumerable<T> items) — iterates and calls Remove for each element
  • CollectionExtensionsTests — adds AddRange_Test and RemoveRange_Test

Usage

var collection = (ICollection<int>)new List<int> { 1, 2, 3 };

collection.AddRange([4, 5, 6]);
// collection == [1, 2, 3, 4, 5, 6]

collection.RemoveRange([2, 4]);
// collection == [1, 3, 5, 6]

@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 17, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 17, 2026 06:41
Copilot AI review requested due to automatic review settings April 17, 2026 06:41
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.54%. Comparing base (667c235) to head (63d8ea6).
⚠️ Report is 2 commits behind head on prime.

Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #39      +/-   ##
==========================================
+ Coverage   94.47%   94.54%   +0.07%     
==========================================
  Files          76       76              
  Lines        1574     1596      +22     
  Branches      131      133       +2     
==========================================
+ Hits         1487     1509      +22     
  Misses         65       65              
  Partials       22       22              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends PowerKit.Extensions.CollectionExtensions with ICollection<T> helpers to add or remove multiple items in one call, aligning the library’s collection utility surface with the referenced CliFx-style API.

Changes:

  • Add ICollection<T>.AddRange(IEnumerable<T>) extension method.
  • Add ICollection<T>.RemoveRange(IEnumerable<T>) extension method.
  • Add unit tests for AddRange and RemoveRange.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
PowerKit/Extensions/CollectionExtensions.cs Adds AddRange/RemoveRange extensions on ICollection<T> alongside existing collection helpers.
PowerKit.Tests/CollectionExtensionsTests.cs Adds happy-path tests covering the new AddRange/RemoveRange methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PowerKit/Extensions/CollectionExtensions.cs Outdated
Comment thread PowerKit/Extensions/CollectionExtensions.cs Outdated
Comment thread PowerKit.Tests/CollectionExtensionsTests.cs
Tyrrrz and others added 2 commits April 17, 2026 09:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants