Add RemoveAll extension for ICollection<T>#16
Merged
Conversation
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/01c759f3-be4f-4d98-9d31-fa2d911d7629 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a missing RemoveAll convenience for ICollection<T> so callers aren’t forced to cast to List<T> (or re-implement the pattern) when removing items by predicate.
Changes:
- Introduces
ICollection<T>.RemoveAll(Func<T, bool>)extension that snapshots the collection and removes matching elements. - Adds an initial unit test covering basic predicate-based removal.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| PowerKit/Extensions/CollectionExtensions.cs | Adds the new RemoveAll extension for ICollection<T>. |
| PowerKit.Tests/CollectionExtensionsTests.cs | Adds basic test coverage for the new extension. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Owner
|
@copilot add test assert for RemoveAll return value |
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/2fd16fda-aa81-44f2-8c88-084a881dd7bc Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Contributor
Author
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ICollection<T>has noRemoveAll— onlyList<T>does. This adds the missing extension so anyICollection<T>implementation can remove elements by predicate.Changes
CollectionExtensions.cs—RemoveAll(Func<T, bool> predicate)onICollection<T>: snapshots viaToArray()then removes matched itemsCollectionExtensionsTests.cs— basic coverage